Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349424 - persists during an preCalculateUnitOfWorkChangeSet event are lost
Summary: persists during an preCalculateUnitOfWorkChangeSet event are lost
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 critical (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-15 08:47 EDT by Patric Rufflar CLA
Modified: 2022-06-09 10:21 EDT (History)
4 users (show)

See Also:


Attachments
Proposed changes (13.56 KB, patch)
2011-07-15 11:26 EDT, Guy Pelletier CLA
no flags Details | Diff
2.3.1 patch (13.37 KB, patch)
2011-07-15 15:08 EDT, Guy Pelletier CLA
no flags Details | Diff
trunk patch (13.77 KB, patch)
2011-07-15 15:19 EDT, Guy Pelletier CLA
no flags Details | Diff

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