This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate PreUpdateEvent does not provide old state of the entity Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Hibernate PreUpdateEvent does not provide old state of the entity" Watch "Hibernate PreUpdateEvent does not provide old state of the entity" New topic
Author

Hibernate PreUpdateEvent does not provide old state of the entity

remyvrs vredestein
Greenhorn

Joined: Feb 11, 2013
Posts: 2
Hello,
i am trying to obtain the minimum between the old value and the new one during an entity update

yet, using the PreUpdateEventListener with the arg : PreUpdateEvent
>>>
Object[] getOldState()
The old state of the entity at the time it was last loaded from the database; can be null in the case of detached entities.
>>>
the old state does come null...

could someone please advice about how to obtain the old state?

btw, i have tried to add a line of
session.buildLockRequest(LockOptions.NONE).lock() , hopping that this will reattach it before the update
yet, in this case, there seems to be problem because the event listener is not triggered anymore
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Hibernate PreUpdateEvent does not provide old state of the entity
 
Similar Threads
Null date merge problem
Exception on cascade of remove in a unidirectional @OneToMany
JPA Delete Entity and Refresh Collections containing Entity
My SCEA Part 1Study Notes
Bulk Update