You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Andy Schlaikjer <ha...@cs.cmu.edu> on 2008/10/07 23:57:08 UTC

OneToMany default join column name is uppercased with MySQL DBDictionary

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


Re: ManyToOne default join column name is uppercased with MySQL DBDictionary

Posted by Andy Schlaikjer <ha...@cs.cmu.edu>.
Mike,

Here's the JIRA issue:

https://issues.apache.org/jira/browse/OPENJPA-741

Cheers,

Michael Dick wrote:
> Hi Andy,
> 
> I don't think this is identical to OPENJPA-626 (since Tim indicated the
> issue was resolved). If you have a JIRA account would you mind opening a new
> JIRA issue for this problem?
> 
> -mike
> 
> On Tue, Oct 7, 2008 at 7:47 PM, Andy Schlaikjer <ha...@cs.cmu.edu> wrote:
> 
>> 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
>>>
>>>
>>>
> 


Re: ManyToOne default join column name is uppercased with MySQL DBDictionary

Posted by Michael Dick <mi...@gmail.com>.
Hi Andy,

I don't think this is identical to OPENJPA-626 (since Tim indicated the
issue was resolved). If you have a JIRA account would you mind opening a new
JIRA issue for this problem?

-mike

On Tue, Oct 7, 2008 at 7:47 PM, Andy Schlaikjer <ha...@cs.cmu.edu> wrote:

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

Re: ManyToOne default join column name is uppercased with MySQL DBDictionary

Posted by Andy Schlaikjer <ha...@cs.cmu.edu>.
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
> 
>