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

Bug 349984

Summary: Cascade Persist not cascaded through managed Entities
Product: z_Archived Reporter: Gordon Yorke <gordon.yorke>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: eclipselink.orm-inbox
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Gordon Yorke CLA 2011-06-21 15:03:49 EDT
In the following testcase A has OneToOne cascade PERSIST to a B which has a OneToOne cascade PERSIST to an C.  The following testcase will always fail.

    A a = new A();
    a.setB(em.find(B.class, b_id));
    C c = new C();
    a.getB().setC(c);
    em.persist(a);
    assertTrue("Failed to cascade persist to 'C'", em.contains(c));
Comment 1 Gordon Yorke CLA 2011-06-21 15:05:36 EDT
The issue is caused by uow.isObjectNew() checks in some mappings cascadeRegisterNewIfRequired methods which do not cascade the PERSIST unless the reference object is "new".  This is in conflict with the requirements of the JPA specification.
Comment 2 Gordon Yorke CLA 2011-06-21 15:17:41 EDT
Not a bug.  The problem only existed because of a partial view update.
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:30:17 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink