Search in sources :

Example 1 with AuditQuery

use of org.hibernate.envers.query.AuditQuery in project hibernate-orm by hibernate.

the class AbstractModifiedFlagsEntityTest method queryForPropertyHasChanged.

protected List queryForPropertyHasChanged(Class<?> clazz, Object id, String... propertyNames) {
    AuditQuery query = createForRevisionsQuery(clazz, id, false);
    addHasChangedProperties(query, propertyNames);
    return query.getResultList();
}
Also used : AuditQuery(org.hibernate.envers.query.AuditQuery)

Example 2 with AuditQuery

use of org.hibernate.envers.query.AuditQuery in project hibernate-orm by hibernate.

the class AbstractModifiedFlagsEntityTest method queryForPropertyHasChangedWithDeleted.

protected List queryForPropertyHasChangedWithDeleted(Class<?> clazz, Object id, String... propertyNames) {
    AuditQuery query = createForRevisionsQuery(clazz, id, true);
    addHasChangedProperties(query, propertyNames);
    return query.getResultList();
}
Also used : AuditQuery(org.hibernate.envers.query.AuditQuery)

Example 3 with AuditQuery

use of org.hibernate.envers.query.AuditQuery in project hibernate-orm by hibernate.

the class AbstractModifiedFlagsEntityTest method queryForPropertyHasNotChanged.

protected List queryForPropertyHasNotChanged(Class<?> clazz, Object id, String... propertyNames) {
    AuditQuery query = createForRevisionsQuery(clazz, id, false);
    addHasNotChangedProperties(query, propertyNames);
    return query.getResultList();
}
Also used : AuditQuery(org.hibernate.envers.query.AuditQuery)

Example 4 with AuditQuery

use of org.hibernate.envers.query.AuditQuery in project hibernate-orm by hibernate.

the class AbstractModifiedFlagsEntityTest method queryForPropertyHasNotChangedWithDeleted.

protected List queryForPropertyHasNotChangedWithDeleted(Class<?> clazz, Object id, String... propertyNames) {
    AuditQuery query = createForRevisionsQuery(clazz, id, true);
    addHasNotChangedProperties(query, propertyNames);
    return query.getResultList();
}
Also used : AuditQuery(org.hibernate.envers.query.AuditQuery)

Example 5 with AuditQuery

use of org.hibernate.envers.query.AuditQuery in project hibernate-orm by hibernate.

the class EmbeddableQuery method testAuditQueryUsingEmbeddableEquals.

@Test
public void testAuditQueryUsingEmbeddableEquals() {
    final NameInfo nameInfo = new NameInfo("John", "Doe");
    final AuditQuery query = getAuditReader().createQuery().forEntitiesAtRevision(Person.class, 1);
    query.add(AuditEntity.property("nameInfo").eq(nameInfo));
    List<?> results = query.getResultList();
    assertEquals(1, results.size());
    final Person person = (Person) results.get(0);
    assertEquals(nameInfo, person.getNameInfo());
}
Also used : AuditQuery(org.hibernate.envers.query.AuditQuery) Test(org.junit.Test)

Aggregations

AuditQuery (org.hibernate.envers.query.AuditQuery)13 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)3 AuditReader (org.hibernate.envers.AuditReader)3 AuditException (org.hibernate.envers.exception.AuditException)1