Created
December 13, 2016 18:53
-
-
Save thjanssen/497757c313dcc9b4898128dac4469a81 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().forEntitiesAtRevision(Book.class, 2); | |
q.traverseRelation(“publisher”, JoinType.LEFT, “p”); | |
q.add(AuditEntity.and( | |
AuditEntity.or(AuditEntity.property(“title”).ilike(“JPA”, MatchMode.ANYWHERE), AuditEntity.property(“title”).ilike(“Hibernate”, MatchMode.ANYWHERE)), | |
AuditEntity.property(“p”, “name”).ilike(“Manning”))); | |
q.addOrder(AuditEntity.property(“title”).asc()); | |
List<Book> audit = 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
AuditQuery q = auditReader.createQuery().forRevisionsOfEntity(Book.class, true, true); | |
q.add(AuditEntity.id().eq(b.getId())); | |
List<Book> audit = 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
AuditQuery q = auditReader.createQuery().forRevisionsOfEntity(Book.class, false, true); | |
q.addProjection(AuditEntity.revisionNumber().min()); | |
q.add(AuditEntity.id().eq(b.getId())); | |
q.add(AuditEntity.property(“title”).eq(“Hibernate Tips – 64 Tips for your day to day work”)); | |
Number revision = (Number) q.getSingleResult(); |
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().forEntitiesAtRevision(Book.class, 2); | |
q.add(AuditEntity.property(“title”).ilike(“Hibernate”, MatchMode.ANYWHERE)); | |
q.addOrder(AuditEntity.property(“title”).asc()); | |
List<Book> audit = q.getResultList(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment