Search in sources :

Example 21 with AuditReader

use of org.hibernate.envers.AuditReader in project wildfly by wildfly.

the class SLSBAuditMO method retrieveOldPhoneListVersionFromCustomer.

public String retrieveOldPhoneListVersionFromCustomer(int id) {
    AuditReader reader = AuditReaderFactory.get(em);
    CustomerMO cust_rev = reader.find(CustomerMO.class, id, 1);
    return cust_rev.getPhones().get(0).getType();
}
Also used : AuditReader(org.hibernate.envers.AuditReader)

Example 22 with AuditReader

use of org.hibernate.envers.AuditReader in project wildfly by wildfly.

the class SLSBOrg method retrieveOldOrgbyId.

public Organization retrieveOldOrgbyId(int id) {
    AuditReader reader = AuditReaderFactory.get(em);
    List<Number> revList = reader.getRevisions(Organization.class, id);
    Organization org1_rev = reader.find(Organization.class, id, 2);
    return org1_rev;
}
Also used : AuditReader(org.hibernate.envers.AuditReader)

Example 23 with AuditReader

use of org.hibernate.envers.AuditReader in project wildfly by wildfly.

the class SLSBPU method retrieveOldPersonVersionFromAddress.

public int retrieveOldPersonVersionFromAddress(int id) {
    AuditReader reader = AuditReaderFactory.get(em);
    Address address1_rev = reader.find(Address.class, id, 1);
    return address1_rev.getPersons().size();
}
Also used : AuditReader(org.hibernate.envers.AuditReader)

Example 24 with AuditReader

use of org.hibernate.envers.AuditReader in project wildfly by wildfly.

the class SLSBValidityStrategyOrg method verifyEndRevision.

public List<Map<String, Object>> verifyEndRevision(Integer id) {
    AuditReader reader = AuditReaderFactory.get(em);
    boolean b;
    String queryString = "select a from " + Organization.class.getName() + "_AUD a where a.originalId.id=:id";
    Query query = em.createQuery(queryString);
    query.setParameter("id", id);
    List<Map<String, Object>> orgHistory = query.getResultList();
    return orgHistory;
}
Also used : Query(javax.persistence.Query) AuditReader(org.hibernate.envers.AuditReader) Map(java.util.Map)

Example 25 with AuditReader

use of org.hibernate.envers.AuditReader in project wildfly by wildfly.

the class SLSBValidityStrategyOrg method retrieveOldOrgbyId.

public Organization retrieveOldOrgbyId(int id) {
    AuditReader reader = AuditReaderFactory.get(em);
    Organization org1_rev = reader.find(Organization.class, id, 2);
    return org1_rev;
}
Also used : AuditReader(org.hibernate.envers.AuditReader)

Aggregations

AuditReader (org.hibernate.envers.AuditReader)51 Test (org.junit.Test)27 Car (org.hibernate.envers.test.integration.query.entities.Car)8 EntityManager (javax.persistence.EntityManager)6 HashSet (java.util.HashSet)5 ArrayList (java.util.ArrayList)4 AuditQuery (org.hibernate.envers.query.AuditQuery)4 List (java.util.List)2 Map (java.util.Map)2 Query (javax.persistence.Query)2 Session (org.hibernate.Session)2 DefaultRevisionEntity (org.hibernate.envers.DefaultRevisionEntity)2 CustomRevEntity (org.hibernate.envers.test.entities.reventity.CustomRevEntity)2 AuditedDataPoint (org.hibernate.osgi.test.client.AuditedDataPoint)2 ServiceReference (org.osgi.framework.ServiceReference)2 Date (java.util.Date)1 EntityManagerFactory (javax.persistence.EntityManagerFactory)1 PersistenceProvider (javax.persistence.spi.PersistenceProvider)1 SessionFactory (org.hibernate.SessionFactory)1 CustomPropertyAccessRevEntity (org.hibernate.envers.test.entities.reventity.CustomPropertyAccessRevEntity)1