Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. @RevisionEntity(YourCustomRevisionListener.class)
  2. public class CustomRevisionEntity {
  3. ...
  4. }
  5.  
  6. org.hibernate.envers.revision_listener=com.company.envers.YourCustomRevisionListener
  7.  
  8. public class YourCustomRevisionListener implements RevisionListener {
  9. @Override
  10. public void newRevision(Object revisionEntity) {
  11. // I am going to assume here you're using a custom revision entity.
  12. // If you are not, you'll need to cast it to the appropriate class implementation.
  13. final CustomRevisionEntity revisionEntityImpl = (CustomRevisionEntity) revisionEntity;
  14. revisionEntityImpl.setTimestamp( resolveValidTimestampValue() );
  15. }
  16.  
  17. private long resolveValidTimestampValue() {
  18. // implement your logic here.
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement