Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 314626

Summary: DDL Generation: Multiple Sets with equal type problem
Product: z_Archived Reporter: Fabian <account>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Fabian CLA 2010-05-27 05:24:07 EDT
Hello,

we faced the following problem using Postgresql 8.4:

Having a class BankAccount with two sets (A and B) both referencing class BookingLine, the generated SQL will be as follows:

- Table BankAccount
  * id
  * ...


- Table BookingLine
  * id
  * ...

- N:M Table BankAccount_BookingLine
  * bankAccount_id NOT NULL
  * setA_bookingLine_id NOT NULL
  * setB_bookingLine_id NOT NULL


See the problem? If I add a new BookingLine to a BankAccount in one set (let's assume set A), the generated SQL will look as follows:

INSERT INTO BankAccount_BookingLine VALUES (1, 23, null)

which leads to a constraint violation because of the NOT NULL constraints.


A workaround: Use @JoinTable to specify a different join table for each set.
I don't know what is the best behaviour in this case but I believe that EclipseLink should not generate a schema that cannot be used properly with the corresponding data model.

Hope it helps,

Fabian
Comment 1 Tom Ware CLA 2010-06-07 14:36:30 EDT
Setting target and priority.  See the following page for details of the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:20:32 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink