use of org.hibernate.envers.query.AuditQuery in project hibernate-orm by hibernate.
the class EmbeddableQuery method testAuditQueryUsingEmbeddableNonEqualityCheck.
@Test
public void testAuditQueryUsingEmbeddableNonEqualityCheck() {
try {
final NameInfo nameInfo = new NameInfo("John", "Doe");
final AuditQuery query = getAuditReader().createQuery().forEntitiesAtRevision(Person.class, 1);
query.add(AuditEntity.property("nameInfo").le(nameInfo));
} catch (Exception ex) {
assertTyping(AuditException.class, ex);
}
}
use of org.hibernate.envers.query.AuditQuery in project wildfly by wildfly.
the class SLSBAudit method verifyRevisionType.
public List<Object> verifyRevisionType(int id) {
AuditReader reader = AuditReaderFactory.get(em);
List<Object> custHistory = new ArrayList<Object>();
List<Number> revList = reader.getRevisions(Customer.class, id);
for (Number revisionNumber : revList) {
AuditQuery query = reader.createQuery().forEntitiesAtRevision(Customer.class, revisionNumber);
query.add(AuditEntity.revisionType().eq(RevisionType.MOD));
if (query.getResultList() != null && query.getResultList().size() > 0) {
custHistory.add(query.getResultList());
}
}
return custHistory;
}
use of org.hibernate.envers.query.AuditQuery in project wildfly by wildfly.
the class SLSBOrg method retrieveDeletedOrgbyId.
public Organization retrieveDeletedOrgbyId(int id) {
AuditReader reader = AuditReaderFactory.get(em);
List<Number> revList = reader.getRevisions(Organization.class, id);
/*for (Number revisionNumber : revList) {
System.out.println("Available revisionNumber for o1:" + revisionNumber);
}*/
List<Object> custHistory = new ArrayList<Object>();
AuditQuery query = reader.createQuery().forRevisionsOfEntity(Organization.class, true, true);
query.add(AuditEntity.revisionType().eq(RevisionType.DEL));
Organization rev = (Organization) (((List<Object>) (query.getResultList())).toArray()[0]);
return rev;
}
Aggregations