Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » DescriptorEventAdapter
DescriptorEventAdapter [message #1006760] Fri, 01 February 2013 17:18 Go to next message
flemmin dalum is currently offline flemmin dalumFriend
Messages: 1
Registered: February 2013
Junior Member
I´m having trouble calling my EntityListener callback methods when using JPQL.
The none of the overriden methods get called.
They do work when using plain merges/inserts/updates (using the EM).
Is this a Eclipselink limitation?
I need this for auditing reasons, storing old and new values of each and every record changed on the DB.
Is there any other (easier) way of doing this?
Re: DescriptorEventAdapter [message #1007114 is a reply to message #1006760] Mon, 04 February 2013 14:08 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1039
Registered: July 2009
Senior Member
You haven't mentioned what JPQL you are issuing that doesn't result in callback methods being called, so I assume it is the bulk update and delete statements. The JPA specification states in section 4.10 "The persistence context is not synchronized with the result of the bulk update or delete.
Caution should be used when executing bulk update or delete operations because they may result in
inconsistencies between the database and the entities in the active persistence context. In general, bulk
update and delete operations should only be performed within a transaction in a new persistence context
or before fetching or accessing entities whose state might be affected by such operations.",

This essentially means that JPA does not update the entities themselves, only the data in the database, and should be done before loading in entities so that the changes can be read in as well. Since the entities are unchanged, events cannot be fired for the changes. You will need to handle recording changes from bulk updates+deletes within the application.
Previous Topic:@Index does not work
Next Topic: javax.persistence.PersistenceException:
Goto Forum:
  


Current Time: Sun Nov 23 17:21:41 GMT 2014

Powered by FUDForum. Page generated in 0.01570 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software