Community
Participate
Working Groups
When one entity defines two separate ManyToMany relationships of the same entity type, a join table is created containing three columns. Here is an example: public class EntityA { @ManyToMany private List<EntityB> list1; @ManyToMany private List<EntityB> list2; } This results in EclipseLink creating the following join table: CREATE TABLE ENTITYA_ENTITYB (EntityA_ID INTEGER NOT NULL, list1_ID INTEGER NOT NULL, list2_ID INTEGER NOT NULL, PRIMARY KEY (EntityA_ID, list1_ID, list2_ID)) The issue is that EclipseLink is creating the join table's columns with a NOTNULL constraint. Then, when EclipseLink inserts values into the table, it will only insert values for two of the columns at a time and will leave the third value as null. This causes an SQLException since the table columns are created with a NOTNULL constraint.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink