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

Bug 343925

Summary: Intermittent failure using Cascade Persist
Product: z_Archived Reporter: Vikram Bhatia <vikram.jeet.bhatia>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: gordon.yorke
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Testcase source
none
Fix including the test case none

Description Vikram Bhatia CLA 2011-04-27 02:05:25 EDT
Intermittent failures are encountered when using CascadeType.PERSIST, it throws

java.lang.IllegalStateException: During synchronization a new object was
found through a relationship that was not marked cascade PERSIST: 

This is typically observed with unregistered objects which are discovered during flush() or commit(). 

EntityX OneToOne EntityY
EntityZ OneToMany EntityY

EntityY is marked as cascade persist from EntityZ relation, but not from EntityX relationship.

If EntityX and EntityY are persisted using em.persist(), and EntityY is set on both EntityX and EntityZ with flush() called, this intermediate failure is observed.
Comment 1 Vikram Bhatia CLA 2011-04-27 02:31:18 EDT
Created attachment 194120 [details]
Testcase source

Steps to reproduce:
1. Unzip, and load project in Eclipse.
2. Change database related entries in persistence.xml
3. Change driver settings and eclipselink.jar location in eclipse project.
4. Execute StandaloneTestCase JUnit test to reproduce the issue.
Comment 2 Vikram Bhatia CLA 2011-04-27 13:41:55 EDT
Created attachment 194187 [details]
Fix including the test case
Comment 3 Vikram Bhatia CLA 2011-04-30 02:32:26 EDT
Fixed in EL trunk
At revision: 9285
Comment 4 Andrei Ilitchev CLA 2012-05-11 13:08:35 EDT
*** Bug 217505 has been marked as a duplicate of this bug. ***
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:20:37 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink