Example usage for org.hibernate.envers AuditReader find

List of usage examples for org.hibernate.envers AuditReader find

Introduction

In this page you can find the example usage for org.hibernate.envers AuditReader find.

Prototype

<T> T find(Class<T> cls, Object primaryKey, Date date) throws IllegalArgumentException, NotAuditedException,
        RevisionDoesNotExistException, IllegalStateException;

Source Link

Document

Find an entity by primary key on the given date.

Usage

From source file:sample.data.jpa.web.SampleController.java

License:Apache License

@RequestMapping("/showCity")
@ResponseBody//  w  ww . ja va  2s  .c o  m
@Transactional(readOnly = true)
public String showRevision() {
    AuditReader reader = AuditReaderFactory.get(entityManager);
    City city_rev1 = reader.find(City.class, cityId, 1);
    City city_rev2 = reader.find(City.class, cityId, 2);
    return "Revision 1: " + city_rev1.toString() + "\n Revision 2: " + city_rev2.toString();
}