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

Bug 346022

Summary: Delete + Insert to a @MantToMany in same transaction causes Inserts to be missed
Product: z_Archived Reporter: Mitesh Meswani <mitesh.meswani>
Component: EclipselinkAssignee: Tom Ware <tom.ware>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P2 CC: eclipselink.orm-inbox, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Reproduction
none
proposed fix none

Description Mitesh Meswani CLA 2011-05-16 21:15:45 EDT
Created attachment 195806 [details]
Reproduction

Attached test case reproduces the issue in JavaSE environment. Here are steps to execute the test case
1. unzip the testcase
2. Adjust build.properties to point to your EcliopseLink workspace
3. Adjust test.properties to point to your database
4. Execute the test using "ant agent run". Observe how expected insert statements into the relationship table are not executed at end of test case

Please note that if agent is not used in above step, insert statements are executed as expected.
Comment 1 Mitesh Meswani CLA 2011-05-16 21:16:11 EDT
This issue was triggered by http://java.net/jira/browse/GLASSFISH-15883
Comment 2 Tom Ware CLA 2011-05-26 14:11:37 EDT
Initial target: 2.3 - pending more triage
Comment 3 Tom Ware CLA 2011-05-26 14:31:56 EDT
Workaround: Use this persistence unit property:

            <property name="eclipselink.weaving.changetracking" value="false"/>
Comment 4 Tom Ware CLA 2011-05-27 11:39:55 EDT
Note: This will only occur if you add and remove the exact same elements.  Any additional added or removed objects will result in the changes being sent.
Comment 5 Tom Ware CLA 2011-05-30 11:52:57 EDT
Created attachment 196914 [details]
proposed fix
Comment 6 Tom Ware CLA 2011-05-30 15:45:27 EDT
The change clears the list of added and removed objects in an IndirectCollection using attribute change tracking at the same time as the change set is cleared

Reviewed by Andrei Ilitchev
Approved by Peter Krogh

Tested with JPA and Core LRG

Added test to EntityManagerJUnitTestCase
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:02:37 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink