Last active
July 18, 2018 14:34
-
-
Save thjanssen/f8313541eb735de0d96d0775cabd2535 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AuditQuery q = auditReader.createQuery().forRevisionsOfEntity(Book.class, false, true); | |
q.addProjection(AuditEntity.revisionNumber()); | |
q.add(AuditEntity.revisionProperty(“userName”).eq(“User 1”)); | |
List<Number> revisionNumbers = q.getResultList(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
@RevisionEntity(MyRevisionListener.class) | |
public class MyRevision extends DefaultRevisionEntity { | |
private String userName; | |
public String getUserName() { | |
return userName; | |
} | |
public void setUserName(String userName) { | |
this.userName = userName; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyRevisionListener implements RevisionListener { | |
@Override | |
public void newRevision(Object revisionEntity) { | |
MyRevision rev = (MyRevision) revisionEntity; | |
rev.setUserName(getUserName()); | |
} | |
… | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment