openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Sutter (Commented) (JIRA)" <>
Subject [jira] [Commented] (OPENJPA-1873) EntityManager#merge sometimes passes wrong entity values to @PostLoad EntityListeners
Date Fri, 09 Dec 2011 00:13:40 GMT


Kevin Sutter commented on OPENJPA-1873:

Your patch/commit looks pretty straight forward.  The JIRA has such a long history, I was
wondering what you finally decided to resolve.  It looks like you have provided a new property
(openjpa.PostLoadOnMerge) which will tell OpenJPA to call the PostLoad listener on every Merge.
 If that's accurate, then some documentation updates would be good to have so that users know
about this new property.  Thanks.

I also noticed that you updated the OpenJPAConfiguration file to define the OPTION_POSTLOAD_ON_MERGE
string.  I don't believe these are really even used any more.  It looks like maybe this was
the old (original) way to specify properties, but the updated plugin configuration is much
easier -- which you also implemented.  Maybe I'm mistaken, but I don't think you need the
OPTION_POSTLOAD_ON_MERGE updates.  Did you find that you required these?

And, it looks like you resolved the problem with incorrect data being dispensed to the PostLoad
listener on a Merge -- iff this new option is set. Is that correct?

> EntityManager#merge sometimes passes wrong entity values to @PostLoad EntityListeners

> --------------------------------------------------------------------------------------
>                 Key: OPENJPA-1873
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.0, 2.0.1, 2.0.2
>            Reporter: Mark Struberg
>            Assignee: Rick Curtis
>             Fix For: 2.2.0
>         Attachments: OPENJPA-1873-fix1.patch, OPENJPA-1873-fix2.patch, OPENJPA-1873-fix3.patch,
OPENJPA-1873-unittest.patch, openjpa-1873-hack-1.patch,
> I've tested this with the latest from branches/2.0.x.
> My entity has an @EntityListeners which observes the @PostLoad lifecycle event. This
listener stores the 'old' values from the database for later use (see
for the intention behind). All works well if the table has only a few rows. But if you add
more rows, OpenJPA tries to optimize the access and only loads the @Version field + the dirty
fields. In this case the merging seems to be wrong, because I get the NEW values from the
dirty fields instead of the original values from the database passed to my @PostLoad method.
> Did cost me a few grey hairs to track down the differences between the working and the
broken scenarios here ;) But finally I was able to creat a unit test showing the problem

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message