openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Schlaikjer <ha...@cs.cmu.edu>
Subject OneToMany default join column name is uppercased with MySQL DBDictionary
Date Tue, 07 Oct 2008 21:57:08 GMT
Hi all,

I recently updated from OpenJPA 1.0.2 to 1.2.0 and noticed that on 
regeneration of my database using the MappingTool some column names are 
now being upper-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'm using the MySQL DBDictionary, and the behavior persists even if I 
set the SchemaCase attribute to "preserve" (can I do this? it doesn't 
seem to have any effect even when set to "upper"):

-Dopenjpa.jdbc.DBDictionary=mysql(SchemaCase=preserve)

Looking at the source for org.apache.openjpa.jdbc.sql.MySQLDictionary 
[1], "preserve" is the default in any case.

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"
}

Has anyone else run into this problem? The closest matching JIRA issue I 
could find is [2].

[1] Just fyi: The 1.2.0 binary distribution archive's openjpa-1.2.0.jar 
contains java source files.
[2] https://issues.apache.org/jira/browse/OPENJPA-626

Thanks,
Andy


Mime
View raw message