Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate PreUpdateEvent does not provide old state of the entity  RSS feed

remyvrs vredestein
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!