I set up an independent test project with Maven so I could quickly jump between OpenJPA versions to test this and I've confirmed that the up-casing of many-to-one join column names when using MySQL is present in OpenJPA versions 1.1.0 and 1.2.0, but not in 1.0.2 nor 1.0.3.

I'd be happy to post the test project if anyone likes.

Cheers,
Andy

Andy Schlaikjer wrote:
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



Reply via email to