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

Bug 331573

Summary: Changes in @PostPersist don't cause update when calling merge after persist
Product: z_Archived Reporter: Robin Stocker <robin>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P2 CC: tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Test case
none
Test entity none

Description Robin Stocker CLA 2010-12-01 12:29:39 EST
Build Identifier: EclipseLink, version: Eclipse Persistence Services - 2.0.1.v20100213-r6600

When setting a field on an entity in a @PostPersist callback (or entity listener), the update is not detected and not written out during a subsequent flush() and merge().

Reproducible: Always

Steps to Reproduce:
See attached test case.
Comment 1 Robin Stocker CLA 2010-12-01 12:30:59 EST
Created attachment 184279 [details]
Test case
Comment 2 Robin Stocker CLA 2010-12-01 12:31:14 EST
Created attachment 184280 [details]
Test entity
Comment 3 Robin Stocker CLA 2010-12-01 12:32:14 EST
Only an insert is issued, like this:

INSERT INTO CALLBACKENTITY (ID, POSTPERSISTSTATE) VALUES (?, ?)
	bind => [1, null]
Comment 4 Tom Ware CLA 2010-12-03 09:04:16 EST
If you haven't done so, it is likely a good idea to go through the mailing lists or forums prior to posting these kinds of bugs.  The reason: There is a good chance someone will be able to provide you with a reasonable workaround.
Comment 5 Robin Stocker CLA 2010-12-06 09:02:59 EST
A workaround is to call detach() before merge(). But that shouldn't be necessary, right? That's what this bug is about.
Comment 6 Tom Ware CLA 2010-12-09 09:11:22 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:19:52 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink