How to detect EJB object property changes in @PreUpdate?

when saving (updating) an object that you call EntityManager.persist (entity) , passing the complete object. Can be intercepted using @PreUpdate .

Does anyone have a recipe on how to determine which properties were changed in this interceptor method? Somehow comparing the old and the new object? It is even better to implement a general method instead of comparing fields by field for each class.

Thanks for any input!

Sven

+5
source share
1 answer

, persist() (insert) . , , .

JPA , . , , API- JPA.

EclipseLink, preUpdate EclipseLink DescriptorEventListener JPA, ObjectChangeSet, Event, .

JPA, , ChangeTracker _persistence_getPropertyChangeListener(), getObjectChangeSet().

TopLink Essentials, , .

+3

All Articles