envers

Get the entity previous version in Hibernate Envers

I have an entity loaded by Hibernate (via EntityManager) User u = em.load(User.class, id) This class is auditaded by Hibernate Envers. I want to load the previous version of this class. How can I do it? Thanks ...

getting started with envers + hibernate (simple and COMPLETE example)

I have Hibernate working and would like to try adding Envers audit/revision functionality but can't seem to figure out what is required. (my example compiles and runs OK and I get the regular Hibernate functionality but no audit tables appear in my database.) Has someone out there done this before? Does it work with H2 database using HSQ...

Populate envers revision tables with existing data from Hibernate Entities

I'm adding envers to an existing hibernate entities. Everything is working smoothly so far as far as auditing, however querying is a different issue because the revision tables aren’t populated with the existing data. Has anyone else already solved this issue? Maybe you’ve found some way to populate the revision tables with the existing ...

stumbling blocks galore while trying to run org.hibernate.tool.ant.EnversHibernateToolTask

I'm trying to run org.hibernate.tool.ant.EnversHibernateToolTask as suggested in the rather terse guide to Envers (2nd line of table, Documentation has a link to a PDF). Here's my ant task tweaked so it successfully finds org.hibernate.tool.ant.EnversHibernateToolTask and org.hibernate.tool.ant.HibernateToolTask; now it can't find org.ap...

what the heck is a JPA configuration?

I'm going nuts trying to get a simple Envers example to work. I'm stuck on the org.hibernate.tool.ant.EnversHibernateToolTask it looks like I finally got all the jar files I needed, but now I get the error message [hibernatetool] Persistence unit not found: 'ConsolePU'. BUILD FAILED C:\deka\proj\java\test-database\build.xml:61: Persi...

difficulties getting a simple envers example to work: problem #34

I'm trying to get a simple envers example to work. I have the Java code working (apparently), and I finally got the org.hibernate.tool.ant.EnversHibernateToolTask to work, but it only outputs SQL for the "regular" data, not the versioning data. I'm stumped for what to do next. What might I be forgetting to include? Here is the SQL it o...

Unable to add custom logging data in REVINFO in envers

I am trying to use Envers for implementing Audit trails. Its creating the audit table Person_AUD and entering the audit data as well. But, when i am trying to add custom fields that is updated by to it, nothing happens. ...

Can't get Envers to work

Envers looks easy. Just add some hibernate properties in your persistence.xml (eventlisteners), and annotate the entities you want to audit. I am testing this on an application using Hibernate. Here is some pom info: - org.hibernate.hibernate-entitymanager:3.4.0.GA - org.hibernate.hibernate-annotations:3.4.0.GA - org.hibernate.hibernate...

GUI for history recorded by Envers

Some time ago we began to record all changes of our EJB3 entities with the help of Envers framework. And now the question is - what GUI can we suggest to users to view this history. The main requirements are: rather easy to implement (cause viewing history is not a service with very high priority) easy for users enough that they will...

Does HibernateTemplate work with Envers? If so, how?

I am trying to use Envers on a project that also uses Hibernate and Spring - and I appreciate a lot the code reduction offered by HibernateTemplate. I configured Envers under JPA, and after a few tweaks I was able to have the schema generated by the EnversHibernateToolTask Ant task (including the auditing tables). However, when I write ...

Hibernate Envers throws AuditException

I am using Envers to get related entity (say entityB) for a given entity (say entityA) for a given version of enityA. I am comparing revision number of entityA with the related entity ie entityB (numbers will be same if they are in same transaction) and coming out with the revision number of entityB. Then I query enitityB like: reade...

NullPointerException at org.hibernate.envers.event.AuditEventListener.generateBidirectionalCollectionChangeWorkUnits(...)

I'm using Envers to audit different fields of my entities. The framework works in general but it seems to have problems with some kinds of entity mapping. All former problems I could solve myself... but this time I'm stuck. When inserting some entity into the database I get the following exception: Caused by: java.lang.NullPointerExcep...

Storage of auditable fields per entity

I guess it's a good practice to capture auditable fields to track what happened to a particular entity (say createdBy, creationDate, modifiedBy, modifiedDate) I am assuming if an object is never modified it makes sense just to capture the following auditable fields for an SNMPv3 event (say createdBy, creationDate) I am assuming if an ...

Hibernate Envers : How to delete entries from my audit table?

Hi everyone, I am currently working with Hibernate Envers. My problem is the following : How to delete entries in the audit table related to the entity I want to delete? My entity has no relation with other entities. I figured out that I have to do that in onPostDelete method of my custom listener : import org.hibernate.envers.event...

Hibernate - Envers - Multiple Audit targets

Hi all, I am already using Hibernate Envers to audit entities that are updated by a user through the UI; however, I also have asynchronous jobs running in the background and would like to audit those as well using Envers. Now, for the UI, I track which HttpRequest made the change which gives me the date, user, session, etc. For the ba...

Hibernate Envers - traversing the relations

In my application, I have a several audited entity classes for example the following. It contains multiple HAS-IS relations to other entities with various hibernate annotations. @Entity @Audited public class Entity implements Serializable { private static final long serialVersionUID = 1L; @Id private Integer Id; @Man...

[Hibernate.Envers] @ManyToMany: REVTYPE is only ADD

Hi, i have the two classes Person and Attribut, in short: @Entity @Indexed @Table(name="persons") public class Person { private int id; private List<Attribute> attributes; @Id @DocumentId @GeneratedValue @Column(name="person_id") public int getId() { return id; } @ManyToMany @JoinTable( name="attribute_all...

Spring 3.x and Hibernate Envers

I'm having a problem getting Hibernate Envers to work in our environment. We are using Spring 3.x with LoadTimeWeaving. Below is our context file: <context:annotation-config/> <context:spring-configured/> <context:load-time-weaver aspectj-weaving="autodetect"/> <context:component-scan base-package="com.viridityenergy.vpower"/> <context:...

Hibernate.Envers: @Audited at @ManyToOne throws Exception

Hi, there are following two classes, related by manytoone-annotation: @Entity public class Firma { @Id @GeneratedValue private int id; @OneToMany(mappedBy = "firma") private List<Mitarbeiter> mitarbeiter; //getter und setter methods } @Entity public class Mitarbeiter { @Id @GeneratedValue private int id; @Audite...

How to manage object revisions in Grails?

I need to implement a revision system for articles in my grails web app. After searching grails forum, stackoverflow, grails plugins and googling internet, I have ended up with 3 options: Option 1 - Using the grails Envers plugin (see http://code.google.com/p/grails-envers-plugin/). Has anyone used it successfully? Or using Envers with...