Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-741

default join column names are up-cased when using MySQL DBDictionary

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.1.0, 1.2.0
    • Fix Version/s: None
    • Component/s: jdbc, third-party
    • Labels:
      None
    • Environment:
      64-bit Linux, Sun JDK 1.6.0_07, mysql-5.0.67-linux-x86_64-glibc23 server, mysql-connector-java 5.1.6

      Description

      On regeneration of database using the MappingTool and the MySQL DBDictionary (did not test with other backend DBs) some column names are being up-cased by default. Not all column names; just join column names involved in @ManyToOne relations (and perhaps elsewhere..):

      @Entity
      public class A {
      @Id
      private long id; // generated column name is "id"

      @ManyToOne
      private A parent; // generated column name is "PARENT_ID"
      }

      I can still force the generated column name to match the desired case by explicitly setting the name attribute of a @JoinColumn annotation:

      @Entity
      public class A {
      @Id
      private long id; // generated column name is "id"

      @ManyToOne
      @JoinColumn(name="parent_id")
      private A parent; // generated column name is "parent_id"
      }

      This bug is not present in OpenJPA versions 1.0.2 nor 1.0.3, but is evident in 1.2.0 and 1.3.0.

      In addition, it seems join column names in collection tables are also affected:

      @Entity
      public class A {
      @Id
      private long id;

      @PersistentCollection
      @CollectionTable
      private Set<String> strings; // generated table "A_strings" has join column "A_ID"
      }

      @Entity
      public class A {
      @Id
      private long id;

      @PersistentCollection
      @CollectionTable(joinColumns =

      { @XJoinColumn(name = "A_id") }

      )
      private Set<String> strings; // generated table "A_strings" has join column "A_id"
      }

      This issue was first discussed in an email thread on openjpa-user mailing list:

      http://thread.gmane.org/gmane.comp.apache.openjpa.user/2846

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              hazen Andy Schlaikjer
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: