Questions tagged [hibernate-envers]

Hibernate Envers is a core module of the Hibernate framework that enables simple entity auditing and change tracking using annotations and simple configuration steps.

Hibernate Envers is a core module of Hibernate.

Envers provides simple entity auditing and change tracking by using Java annotations to influence what it to be tracked by the change management listeners. The module allows you to save historical changes (CRUD operations) made on your persistent entities in audit specific tables that are created by Envers automatically.

Official site:
http://www.hibernate.org/orm/envers

To take advantage of Hibernate Envers, you first need to add the dependency. You simply need to configure the dependency as follows:

<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-envers</artifactId>
  <version>5.2.8.Final</version>
</dependency>

It's important to remember that the version of Envers you should use must match the same version of Hibernate that your application is using.

A Simple Example

@Entity
@Audited
public class Person {
  @Id
  private Integer id;
  private String name;
  private Date dateOfBirth;
  // getter/setters
}

Guides And Tutorials:

807 questions
0
votes
0 answers

Envers pulling back lots of data

I am currently auditing my db with envers and it's doing a great job. I have parsed various entities and show results in the UI which also works well. I have now reached a problem with the performance. I am querying an entity to get a record and…
RNJ
  • 14,308
  • 16
  • 73
  • 125
0
votes
1 answer

Automatic audit table creation while initial schema creation

I am trying to use hibernate and envers and want to create initial data in the schema using following property:
niks75
  • 73
  • 6
0
votes
0 answers

strategy for archiving obsolete rows using Hibernate /MySQL

In our web application we have a MySQL table that stores details of notifications that are sent to users. These notifications, once read by the user, are flagged as 'dismissed' and unlikely to be viewed again, but we can't permanently delete them.…
otter606
  • 317
  • 1
  • 3
  • 18
0
votes
1 answer

Envers @ManyToMany subquery

I have an audited entity A. Entity A holds field 'name' and a collection of entities B (annotated as Many-to-many relationship). I created an instance of A, defined name, collection of entities B and save all it into DB. This is revision #1. Then I…
rholovakha
  • 478
  • 2
  • 5
  • 13
0
votes
3 answers

Hibernate Envers How to record additional audit data such as table name being audited

I have implemented a solution of Hibernate Envers. I am extending RevisionLister by creating my own class to store the system username: import org.hibernate.envers.RevisionListener; public class CustomRevisionListener implements…
babb
  • 393
  • 1
  • 12
  • 38
0
votes
1 answer

Hibernate Envers with JBoss, Spring and Maven - Doesn't write audit record

I am trying to do a Hibernate Envers implementation in conjuction with Spring, JBoss and Maven. I have the following: spring.version: 3.1.0.RELEASE hibernate.version: 3.5.0-Final log4j.version: 1.2.14 jboss-as-7.1.1.Final mysql DB In the pom.xml I…
babb
  • 393
  • 1
  • 12
  • 38
0
votes
1 answer

Is it possible to use Envers 4 with Hibernate 3?

Currently, we are using the version 3.6.9.Final for all our Hibernate libraries, including Hibernate Envers for our audit revisions. We want to move to the 4.1.8.Final version (to use the @Audited(withModifiedFlag = true) among others things), but…
Romain Linsolas
  • 73,921
  • 45
  • 197
  • 265
0
votes
1 answer

'elements(a,b,c) in elements(foo.elements)' in hql?

I have an entity as follows: public class Foo { private List bars; @ElementCollection(fetch=FetchType.LAZY) @CollectionTable(name="T_BARS", joinColumns=@JoinColumn(name = "ID")) @Column(name="BAR") public List
phury
  • 1,819
  • 1
  • 18
  • 32
0
votes
1 answer

Query for revision at which entities of a given class changed in a specific attribute

Looking for Envers documentation here http://docs.jboss.org/envers/docs/index.html#revisions-of-entity I'm trying to query for revisions (LIST!) where a specific object property is changed. In the documentation example you have a person class with…
Francesco
  • 225
  • 1
  • 3
  • 13
0
votes
1 answer

Error creating Envers's EntityManagerFactory when annotations are present

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…
peremann
0
votes
1 answer

How do I audit database changes with the Play Framework?

I'm learning the Play Framework... and I'm wondering how to implement an auditing mechanism to track DB operations (add, modify, delete). For instance, I'd expect something very similar to Hibernate where audit tables are created automatically...…
j3d
  • 8,708
  • 17
  • 76
  • 150
0
votes
1 answer

Hibernate Envers: usage of 'in' in the query

I have three Tables A, B, and AB. AB table is a relationship table. So AB_AUD table has abID as PK, and aId, bID, Revision Info. I've got list of 'bIds' and would like to retrieve audit data from AB_AUD table using the list. My code block…
shashdr
  • 65
  • 2
  • 7
0
votes
1 answer

Hibernate envers is not working

I just want to use hibernate envers in order to audit my entities.I am using envers-1.2.2.ga-hibernate-3.3.jar,hibernate-annotations-3.5.6-Final.jar,hibernate-core-3.5.2-Final.jar and hibernate-jpa-2.0-api-1.0.0.Final.jar. My entity is…
Kamalam
  • 1,124
  • 4
  • 16
  • 31
0
votes
1 answer

Hibernate Envers - org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

I am using Hibernate Envar for Audit purpose. Here is my code and configuration hibernate.cfg.xml file configuration
Rahul Agrawal
  • 8,583
  • 16
  • 42
  • 59
0
votes
1 answer

How to create Junit for the code that uses envers?

I am to write a JUnit to check that version is being maintained or not(on an event). Here is what I did using JUnit: @Test Public void testAudit() { try { //create Dao code dao.save(); //This will create entry in AUD- and…
sandy
  • 1,111
  • 4
  • 20
  • 38
1 2 3
53
54