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

Bug 349424

Summary: persists during an preCalculateUnitOfWorkChangeSet event are lost
Product: z_Archived Reporter: Patric Rufflar <patric>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P2 CC: eclipselink.orm-inbox, fs5, guy.pelletier, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed changes
none
2.3.1 patch
none
trunk patch none

Description Patric Rufflar CLA 2011-06-15 08:47:12 EDT
Build Identifier: 2.1.3 and newer

The patch of bug 243993 causes the regression that newly persisted entities (and maybe other changes as well) which are made in the event listener during a preCalculateUnitOfWorkChangeSet event are lost or at least not written properly to the database.

The reason is that EL is now cloning the clone mapping which causes that  persists made in the event
listener will update the original map only - but not the created clone which
gets used in calculateChanges() and in subsequent database actions.

As a consequence we cannot use EclipseLink releases > 2.1.2.
For us, it's a blocker.

Is there a workaround available?

BTW: bug 332723 would also help me in this case - so I don't have to misuse preCalculateUnitOfWorkChangeSet for reacting on a flush().

Reproducible: Always

Steps to Reproduce:
1. create and register a event listener which persists an entity during the preCalculateUnitOfWorkChangeSet event 
2. call flush() or commit() on the EntityManager
3. new entity can not be found in the database
Comment 1 Tom Ware CLA 2011-06-23 10:18:20 EDT
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 2 Guy Pelletier CLA 2011-07-15 11:26:10 EDT
Created attachment 199753 [details]
Proposed changes
Comment 3 Guy Pelletier CLA 2011-07-15 15:08:36 EDT
Created attachment 199769 [details]
2.3.1 patch
Comment 4 Guy Pelletier CLA 2011-07-15 15:19:21 EDT
Created attachment 199770 [details]
trunk patch
Comment 5 Guy Pelletier CLA 2011-07-15 15:45:34 EDT
Changes have been submitted to 2.2.1, 2.3.1 and trunk.

Verified by: Chris Delahunt

Tests: New test (testSessionEventListenerOnBus) added to LifecycleCallbackJunitTest
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:21:49 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink