jUDDI
  1. jUDDI
  2. JUDDI-136

How to deal with a table prefix (JUDDI_) when using JPA

    Details

    • Type: Task Task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0beta
    • Component/s: None
    • Labels:
      None

      Description

      We may be able to see how jBPM handles this, they use straight hibernate though.

        Activity

        Hide
        Kurt T Stam added a comment -

        This should cover 80% of this requirement. I will try putting in an enhancement request for the JPA spec.

        Show
        Kurt T Stam added a comment - This should cover 80% of this requirement. I will try putting in an enhancement request for the JPA spec.
        Hide
        Kurt T Stam added a comment -

        The easy way out would be to hard-code the juddiv3_ prefix to each table name, maybe the next JPA spec will support it.

        Show
        Kurt T Stam added a comment - The easy way out would be to hard-code the juddiv3_ prefix to each table name, maybe the next JPA spec will support it.
        Hide
        Kurt T Stam added a comment - - edited

        We should keep the setting of the prefix configurable. Unfortunately it does not seem that JPA, and neither the OpenJPA and Hibernate implementations support this.

        In Hibernate we will need to add our own ImprovedNameStrategy as described here: http://forum.hibernate.org/viewtopic.php?p=2376564&sid=d707c1d84722234dafbeae72a7e8dba9

        In OpenJPA, this can be accomplished by creating an extended DBDictionary and overriding the
        getValidTableName() method." I posted the question on their forum: http://n2.nabble.com/Is-there-any-way-to-configure-a-table-prefix-across-all-entity-tables--td2289858.html

        Show
        Kurt T Stam added a comment - - edited We should keep the setting of the prefix configurable. Unfortunately it does not seem that JPA, and neither the OpenJPA and Hibernate implementations support this. In Hibernate we will need to add our own ImprovedNameStrategy as described here: http://forum.hibernate.org/viewtopic.php?p=2376564&sid=d707c1d84722234dafbeae72a7e8dba9 In OpenJPA, this can be accomplished by creating an extended DBDictionary and overriding the getValidTableName() method." I posted the question on their forum: http://n2.nabble.com/Is-there-any-way-to-configure-a-table-prefix-across-all-entity-tables--td2289858.html
        Hide
        Marcos Vincius added a comment -

        Hello!

        I've find a solution regarding dealing with table prefixes when using open JPA.
        So i put an anotation right above the class name that is going to represent the
        table in the database. The annotation is:

        @Table

        {name="name_of_the_table"}

        For example:
        ----------------------------------------------------------------------------------------------------------------

        import javax.persistence.*;

        @Entity
        @Table(name="juddi_BusinessEntity")
        public class Message {
        @Id
        private int id = 12;

        @Basic
        private String name;

        public BusinessEntity() {
        }

        public BusinessEntity(String name)

        { this.name = name; }

        public void setId(int id) { this.id = id; }

        public int getId() { return id; }

        public void setName(String name) { this.name = name; }

        public String getName()

        { return name; }


        }

        ----------------------------------------------------------------------------------------------------------------

        Show
        Marcos Vincius added a comment - Hello! I've find a solution regarding dealing with table prefixes when using open JPA. So i put an anotation right above the class name that is going to represent the table in the database. The annotation is: @Table {name="name_of_the_table"} For example: ---------------------------------------------------------------------------------------------------------------- import javax.persistence.*; @Entity @Table(name="juddi_BusinessEntity") public class Message { @Id private int id = 12; @Basic private String name; public BusinessEntity() { } public BusinessEntity(String name) { this.name = name; } public void setId(int id) { this.id = id; } public int getId() { return id; } public void setName(String name) { this.name = name; } public String getName() { return name; } } ----------------------------------------------------------------------------------------------------------------

          People

          • Assignee:
            Kurt T Stam
            Reporter:
            Kurt T Stam
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development