Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Legacy database ddl generation with duplicate column definition.

Well, you do have quick eyes. However, this is not the problem. This legacy
database use "FcorpID" in exercise table and use "FCoprID" in member table.
The design is such, hence the difference in mapping column names. It's not
the error.

I searched hibernate forum for similar questions, it seemed that hibernate
has this issue too. I don't know if it's solved yet though. 

If I leave insertable and updatble to default, I can even not able to update
table data since there're duplicate mappings. As I turn off these settings,
updaing is working fine, but there lacks a way to notify also schema
creation that only one mapping of the two is needed.


christopher delahunt wrote:
> 
> Hello,
> 
> EclipseLink is case sensitive when it comes to processing column names, 
> but most databases are not.  If you have "FcorpID" in the join column as 
> the foreign key but "FCorpID" in the ExcercisePK mapping EclipseLink 
> will treat them as two separate fields instead of the same field.  This 
> could be why you are getting the exception on DDL generation, as 
> EclipseLink will try to create both fields separately.  Solution is to 
> make the field names the same in all definitions.
> 
> Best Regards,
> Chris
> 
> zaya wrote:
>> It seems to be a bug of eclipselink. I'm working on a legacy database.
>> The
>> mapping of table is like:
>>
>> [code]
>> ... table definition
>>
>> @EmbeddedId
>>     protected ExercisePK key;
>>
>> ... many other columns
>>
>> @ManyToOne
>>     @JoinColumns({
>>  
>> @JoinColumn(name="FMemberID",referencedColumnName="FMemberID",insertable=false,updatable=false),
>>   @JoinColumn(name="FcorpID", referencedColumnName="FCorpID",
>> insertable=false, updatable=false)
>>     })
>>     private AppMember appMember;
>>
>>
>> [/code]
>>
>> The problem here is that the composite primary key is composed of the
>> table
>> auto id and also the "FcorpID" column. Because FcorpID is a global
>> identifier which exits in every table to distingush similar data from
>> other
>> corporations.
>>
>> The mapping itself works fine. But when I want to test database using in
>> memory db and generate ddl, eclipselink throw exception that it said the
>> column definition "FcorpID" is duplicated and table is not created.
>>
>> I'm wondering if this is a bug or there's some configuration I can use to
>> let eclipselink know that only one column here is needed like when
>> persisting I turn off insertable and updatable to disable the second
>> column's modification. Or is this a missing feature?
>>   
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> 
> 

-- 
View this message in context: http://old.nabble.com/Legacy-database-ddl-generation-with-duplicate-column-definition.-tp27662400p27714116.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top