Hi Jim,

could you provide some same sample code?
If your entity has values set before persist is called, then I can't imagine 
how they would disappear when the PrePersist callback method is invoked.
Example 3.5.3 in the JPA 2.0 spec shows that you should be able to access 
persistent fields/properties of your entity in the context of a PrePersist 
callback.


Tobias

-----Original Message-----
From: Jim Talbut [mailto:jtal...@spudsoft.co.uk]
Sent: Freitag, 6. Dezember 2013 17:15
To: users@openjpa.apache.org
Subject: Callback before items are persisted

Hi,

I want to modify a couple of persisted columns in an entity based on
data in other columns (basically caching some stuff from related entities).
I was under the impression that a lifecycle listener on PrePersist would
make this easy - but that is called from within the call to persist,
which is before any columns in the new entity have any values at all.

There doesn't seem to be any callback that is called just before an
object is written the database, is this true?

Thanks.

Jim

________________________________

Firma: Capgemini Deutschland GmbH
Geschäftsführer: Dr. Michael Schulte (Sprecher) • Dr. Uwe Dumslaff • Josef 
Ranner
Aufsichtsratsvorsitzender: Antonio Schnieder
Amtsgericht Berlin-Charlottenburg, HRB 98814
This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient, you are not authorized 
to read, print, retain, copy, disseminate, distribute, or use this message or 
any part thereof. If you receive this message in error, please notify the 
sender immediately and delete all copies of this message.

Reply via email to