• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to track EJB entity property changes in @PreUpdate ?

 
Sven Hefner
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic