I have been looking at Hibernate Envers for entity auditing. I'm using EclipseLink but I'd like something similar.
I've seen some implementations that involve creating a SessionCustomizer to handle some of the persistence of auditing data. I'd really like something like Hibernate where I can simply annotate the ent开发者_如何学运维ity and have the same effect.
Unfortunately, EclipseLink doesn't have a feature which covers auditing out-of-the-box.
We use a SessionEventListener to intercept a flush or commit and use the calculated changeset for inserting the auditing data into audit tables.
There is support for auditing of entities in EclipseLink. They call it History.
http://wiki.eclipse.org/EclipseLink/Examples/JPA/History
精彩评论