Community
Participate
Working Groups
A has OneToOne to B with cascade merge. Create and persist a new B, close the EntityManager - the B is now detached. Create a new A, make it reference the B, change state of the B. Merge the A in a new EntityManager. Result: B is not merged - still has an old state both in cache and data base.
Created attachment 191796 [details] suggested patch The patch was suggested by James: in UnitOfWorkImpl.internalRegisterObject add registeredObject to newMergedObjects only if it's a new object.
Created attachment 191797 [details] suggested patch - take 2 Adding a file forgotten in the first patch.
Checked into trunk. Added EntityManagerJUnitTestSuite.testMergeNewReferencingOldChanged Also added testMergeNewReferencingOldChangedClearCache - for now commented out until (closely related) bug 340810 - merge problem: existing object referenced by new not cascade merged if not in cache is fixed.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink