Example usage for org.hibernate.envers AuditReaderFactory get

List of usage examples for org.hibernate.envers AuditReaderFactory get

Introduction

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

Prototype

public static AuditReader get(EntityManager entityManager) throws AuditException 

Source Link

Document

Create an audit reader associated with an open entity manager.

Usage

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

License:Apache License

@RequestMapping("/showCity")
@ResponseBody// www  .jav a2  s .  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();
}