Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
1.1.0, 1.2.0
-
None
-
None
-
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 =
)
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: