Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349984 - Cascade Persist not cascaded through managed Entities
Summary: Cascade Persist not cascaded through managed Entities
Status: RESOLVED INVALID
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-21 15:03 EDT by Gordon Yorke CLA
Modified: 2022-06-09 10:30 EDT (History)
1 user (show)

See Also:


Attachments

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