Community
Participate
Working Groups
Created attachment 221263 [details] Test case for this issue as a maven project See also: http://www.eclipse.org/forums/index.php/mv/msg/378122/915956/#msg_915956 I've been experiencing foreign key violation whil trying to update a set of entities. These entities together form a tree-like structure, which is saved completely in one go (CascadeType.ALL and orphanRemoval=true is set on all relations). Given the following structure (letters stand for entity types): Code: [Select all] [Show/ hide] A -> B -> B ... B -> C -> D -> [E,F,G] -> B ... B -> C -> D -> [E,F,G] All relations are @OneToMany and bi-directional, except the relation between D and E,F,G. E, F and G share a common super class (marked as entity). The relation is privately owned/uni-directional. This relation is also configured to use a @JoinTable The following scenario fails: - Initially the first row is in the database and retrieved - The first row is removed starting from the second B - The second row is added (effectively replacing the original row) - The complete set is stored In the logging I case see that EclipseLink first tries to remove [E,F,G], before removing the row in the @JoinTable, causing a SQL Integraty exception obviously. Traced from the EclipseLink (2.3.3) code, this starts from ManyToManyMapping.java line 945. Tested EclipseLink 2.3.0 - 2.4.0, same result for each Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=350599 seems related by the description? - Am I expecting behaviour from JPA/EclipseLink which is outside of the spec or is this a bug? - Any ideas for a workaround for this issue?
This issue occurs from at least 2.3.0 - 2.4.0 (tested/verified)
Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Community: Please vote for this bug if it is important to you. Votes are one of the main criteria we use to determine which bugs to fix next.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink