Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343925 - Intermittent failure using Cascade Persist
Summary: Intermittent failure using Cascade Persist
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 217505 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-04-27 02:05 EDT by Vikram Bhatia CLA
Modified: 2022-06-09 10:20 EDT (History)
1 user (show)

See Also:


Attachments
Testcase source (5.20 KB, application/x-zip-compressed)
2011-04-27 02:31 EDT, Vikram Bhatia CLA
no flags Details
Fix including the test case (44.58 KB, patch)
2011-04-27 13:41 EDT, Vikram Bhatia CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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