GeeCON Prague 2014*
The moose likes EJB and other Java EE Technologies and the fly likes How to track EJB entity property changes in @PreUpdate ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to track EJB entity property changes in @PreUpdate ? " Watch "How to track EJB entity property changes in @PreUpdate ? " New topic
Author

How to track EJB entity property changes in @PreUpdate ?

Sven Hefner
Greenhorn

Joined: Feb 27, 2008
Posts: 4
Hi !

when persisting (updating) an entity you would call EntityManager.persist(entity) passing the complete entity. It is possible to intercept with @PreUpdate.

Does anyone have a recipe how to identify which properties have changed in this interceptor method ? Somehow comparing the old and the new entity ? Even better to implement a generic method instead of comparing field by field for each class.

Thanks for any insights

Sven
 
GeeCON Prague 2014
 
subject: How to track EJB entity property changes in @PreUpdate ?