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.

Filter by
Sorted by
Tagged with
1
vote
0answers
5 views

Alternative to deprecated AuditReader#getCurrentRevision method

I am migrating a java application from Spring Boot 1.5 to Spring Boot 2.2.3 and this involves upgrading Hibernate/Envers to 5.4.10.Final. The existing code calls AuditReader#getCurrentRevision(Class ...
0
votes
2answers
18 views

Moving auditing table with java envers to new database instance

I have a Mysql DB, schema name "myschema". This schema has tables, where some of this tables are audit tables. This is my dependency on my java project. <dependency> <groupId>org....
0
votes
1answer
15 views

How do I pass properties to Enver in Grails 3?

I am using Hibernate Envers in my Grails app, and trying to set the org.hibernate.envers.audit_strategy property. What is the correct way to configure this? I have tried adding the following to ...
0
votes
2answers
20 views

How do I trigger entity onLoad() using hibernate Envers?

I am adding Hibernate Envers to my Grails 3 project. I noticed that for one of my entities, which has an onLoad() event, the onLoad() event is never invoked for Envers revision entities. How can I ...
0
votes
1answer
14 views

Hibernate Envers query Audit table with custom query

I am using Hibernate Envers to audit entities. There is this possibility to get all versions / revisions of an entity like this: AuditQuery auditQuery = auditReader.createQuery()....
0
votes
1answer
18 views

Hibernate Envers: prevent version on onPostDelete

I would like to stop Hibernate Envers from creating a version if the audited entity is deleted. The issue is, that instead of an delete version (REVTYPE: 2) and updated version (REVTYPE: 1) is ...
1
vote
1answer
17 views

how to stop auditing create operations in hibernate envers?

I just want to audit the update and delete operations but hibernate envers also logs the INSERT operations, how can we stop auditing the insert operations? application.properties spring.jpa....
1
vote
0answers
44 views

Hibernate 5.2.8.Final wrong binding index

I use hibernate-envers to read data from audit table using this code: AuditReader auditReader = AuditReaderFactory.get(entityManager); AuditQuery auditQuery = auditReader.createQuery()....
0
votes
1answer
37 views

Hibernate Enver throws Object not found exception for auditReader.find()

I joined a project where they implemented Springboot v.2.0.5, Hibernate + Envers v5.3.7. My job is now to generate logs for a nice little endpoint. When I try to do this utilizing the auditreader ...
2
votes
1answer
49 views

How to track delete events with Spring Data JPA Auditing and Envers?

In my audited entity i have fields: @LastModifiedBy private String lastModifiedBy; @LastModifiedDate private OffsetDateTime lastModifiedDate; But they doesn't change when entity is deleted. As i ...
0
votes
1answer
21 views

How to catch errors in Envers?

I have set my auto updating of tables to none spring.jpa.properties.hibernate.hbm2ddl.auto=none That way when I am running Envers I will have to create the audit tables on my own. However when I ...
0
votes
1answer
17 views

Disable Envers in properties file

I have already referred to this question: Spring Boot 2 - disable Envers, but the answer did not work for me. I am using Spring Boot and would like to disable Envers in the properties file without ...
1
vote
1answer
35 views

Hibernate - Skip Envers historisation for specific action or a transaction

We are currently using Envers to do Historisation. Sometimes we have to create temporary copies of certain data or simply don't want certain things to end up in history. Currently, we have a really ...
0
votes
2answers
25 views

Log Creation/Altering of Tables By Envers Hibernate

1) When does Hibernate Envers create or alter the audit tables in the schema when there is a new Entity or column that is annotated with @Audited? 2) Is there a way to log the mysql commands that ...
0
votes
1answer
34 views

Hibernate Envers Audit Query- retrieve only the most recent revision for all entities

I would like to retrieve the all recent versions of all entities( i.e. everything in Database) that has changed recently. Following query fetch revisions of specific entity "MyEntity" queryObject = ...
0
votes
1answer
44 views

Hibernate Envers: How to capture who deleted an entity in audit table

I am using hibernate-envers with spring. Everything works just fine, except when I delete an entity, it does not change the values of updated_by and updated_date inside audit table, instead it saves ...
0
votes
0answers
13 views

Stop Hibernate Envers from looking in _AUD table when RelationTargetAuditMode.NOT_AUDITED is used

I have the following two entities, Change and Post: @Audited @Entity(name = "CHANGE") public class Change{ @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) @ManyToOne(fetch = ...
0
votes
1answer
47 views

Is there a way to capture all hibernate changes made, grouped by transaction?

I know I can create Pre/Post Insert/Update/Delete listeners, and I can record these events, but given that multiple transactions from multiple threads can be running at the same time, I'm not sure how ...
0
votes
1answer
88 views

Hibernate Envers Old-New Values

I have a table like below. ╔════╦══════════════╦══════╗ ║ Id ║ User ║ Age ║ ╠════╬══════════════╬══════╣ ║ 1 ║ Foo Bar ║ 35 ║ ║ 2 ║ Bar Foo ║ 40 ║ ║ 3 ║ Bob Dixon ║ 50 ║...
0
votes
1answer
46 views

Hibernate Envers disable RevisionListener

I'm using a "custom" envers RevisionListener to audit the access-token (autowired into listener, request scoped bean) at every revision. Problem: in the setup/teardown of my integration tests I ...
0
votes
1answer
54 views

How to get Hibernate Envers with Spring integration testing?

Is there some way to get Hibernate Envers to run immediately on the call to save or update instead of going at the end of the transaction ? I have a @Transactional annotation on my (effectively end-...
0
votes
1answer
126 views

Hibernate Envers cannot delete entity

I really have a weird issue now. I just want to delete an entity. I am also using Hibernate envers for auditing. So now I want to delete this entity. Now I get following message. com.mysql.jdbc....
1
vote
1answer
40 views

Hibernate Envers modifiedFlag column name

I'm using Hibernate Envers 5.3.7 and have the following Entity: @Audited(withModifiedFlag=true) public class MyEntity { @Column(name = "item_condition") private String condition; As you can ...
0
votes
1answer
349 views

How to inject spring beans into the hibernate envers RevisionListener

I am using Spring 5.1 and Hibernate 5.3.9 including hibernate-envers. I don't know how to inject spring beans into the hibernate envers custom RevisionListener. I have tried (@Service or @...
6
votes
1answer
122 views

How to resolve deadlock in MySQL due to hibernate envers auditing?

While running few transactions in parallel, most of the time I get deadlock as : ------------------------ LATEST DETECTED DEADLOCK ------------------------ 2019-09-04 06:19:12 0x2b01917c7700 *** (1) ...
0
votes
1answer
53 views

Envers revinfo table empty but _aud table is fine - Spring Boot

I am pretty new to Envers - started yesterday. I am trying to extend an existing Spring Boot standalone application with Audit support using Envers. Since I had an issues in the beginning with an ...
0
votes
2answers
73 views

Envers NullPointerException when creating test data

I am brand new to Envers - started today. I am extending an existing Spring Boot application with Audit support using Envers. I annotated all @Entity classes and made some changes, as described here ...
0
votes
1answer
23 views

Envers + MYSQL + List<String> = SQLSyntaxErrorException: Specified key was too long;

I am extending an existing application with Audit support using Envers. I annotated all @Entity classes and I got a bunch of Exception traces. When taking a look at them, it seems that they all ...
0
votes
1answer
46 views

I am trying to connect 2 tables to have same rev number using hibernate envers?

I have customer entity that have List of accounts and each entity have audited tables,so tables generated will be : (CUSTOMERS ,ACCOUNTS ,CUSTOMERS_AUD ,ACCOUNTS_AUD) how can I connect the change of ...
0
votes
0answers
30 views

Why is Envers deleting new record after reading REVINFO

My current project is using Hibernate Envers for auditing tables. I have an entity declared as follows: @Entity @Table(name = "CONFIG") @Audited() @Data @JsonIgnoreProperties({ "...
0
votes
1answer
29 views

How to target specific Envers revision in entity relationship to @Audited entity?

I need to maintain entity A relationship to certain revision of @Audited entity B, so that the relationship doesn't always point to the latest version (which is the default behaviour). Is there a ...
2
votes
2answers
90 views

Invocation of init method failed; nested exception is java.lang.NoSuchMethodError after adding Hibernate envers

I'm trying to add hibernate-envers to one of our Spring MVC project. My entity classes are in separate maven module and I'm using envers there and then install this as local maven repo and use in my ...
0
votes
1answer
47 views

Hibernate envers get deleted row data

In my application, I need to show what rows were deleted. I need to find deleted row details of a particular class. So far I got a query that returns deleted entity id, how do I get all entity fields?...
0
votes
1answer
68 views

Hibernate Envers targetAuditMode = RelationTargetAuditMode.NOT_AUDITED not working

I have the following class: @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) public class Yard extends ModelObject { // Relations @ManyToOne(optional=false) @JoinColumn(...
0
votes
1answer
27 views

Hibernate Envers replace current data entry with previous audit table entry

I've been using hibernate envers to for auditing purpose in my spring-boot app but there's a requirement where I need to give an option to revert to the previous record from the audit table. In the ...
0
votes
0answers
33 views

Is there any way to avoid audit recording of @Scheduled function actions in database?

We're implementing Envers in a project that has some scheduled tasks which manipulates database records. We don't want these actions to be recorded in audit tables, only the ones users do. Is there ...
1
vote
1answer
36 views

How to make hibernate enhancement plugin ignore some classes?

I use hibernate-enhancement-plugin in my project to implement lazy loading of some entities. But also I have a class AuditEntity that inherits from class DefaultTrackingModifiedEntitiesRevisionEntity ...
0
votes
1answer
224 views

Hibernate-Envers Audit Query: Select latest entity revision where field was equal to value across all entities

I am trying to select the most recent revision of each of my trackedResource entities where a position_source_feed_id has particular value. I have a functional PostgreSQL query: select tr0.* from ...
0
votes
1answer
34 views

How to run one-off script to manipulate jpa entities data and keep trace on envers?

I want to run a one-off script on spring to modify jpa entities and I would like those changes to appear on envers audit tables. I have a spring-boot application using envers to keep track of changes ...
5
votes
0answers
89 views

How to implement @Auditable with dropwizard

I want to implement @Auditable with Dropwizard. Which will create the *_audit table and also store the details with Revinfo table? I am using Dropwizard with Liquibase. I have added @Auditable on ...
0
votes
1answer
118 views

Envers queries use wrong column names for _MOD columns

I am using Hibernate Envers with the @Audited( withModifiedFlag=true ) and I have a problem where the SQL generated for queries has different column names than the one generated by the HBM2DDL tool ...
0
votes
1answer
344 views

Auditing Embeddable Entity using Hibernate Envers

I am trying to add auditing support using Hibernate Envers to the table where entity relations are stored. I am using Spring Boot 2.1.5 and Hibernate 5.3.10. Below are my classes: AuditEntity ...
0
votes
1answer
333 views

How to disable envers auditing for spring boot

i am creating a maven multimoduled project one of the module for the hibernate entity only , issue is two services/api/maven_project are using same module , but one requires auditing but other dont , ...
0
votes
0answers
44 views

Hibernate envers with self entity

I have an requirement where we an entity with self entity and want to audit them. Have a look at it below: @Entity @Table(name = TableNames.CLIENT) @EqualsAndHashCode(exclude="clientContacts") @...
0
votes
0answers
13 views

synchronize all rev from custom_revinfo

Hi i am working on multimoduled (maven) + microsevice based application uses Hibernate envers ,in one of the service i have created uses "custom_revinfo" table, in another service its working with ...
0
votes
0answers
23 views

How to add specific columns for only in *.AUD table not Entity?

I have one table and AUD table of this table. But Aud table has two extra columns like "Inserted_Date" and "Insert_By". Main table haven't this two columns. "Inserted_Date" column include insert time ...
0
votes
1answer
1k views

Are there any ways to create persistent entity example given its class or type?

I am using Hibernate Envers to audit entity changes and we have a lot of audited Hibernate entities in our project. So I want to write a test which for every entity did the following: 1) creates ...
0
votes
1answer
166 views

Setting custom revision information with Hibernate Envers on OpenLiberty

We're migrating an application from JEE7 to JEE8. This application relies on Hibernate-ORM and Hibernate-Envers. On JEE7 it was version 5.2.17, on JEE8 it is 5.4.3 now for both liberaries. We have a ...
0
votes
1answer
19 views

Revision contains null values of other fields if change the @oneToMany - entity by adding a new entity

When a new address is added for a person, a new revision should be created. A revision is created, but the remaining fields of the entity in the revision are marked null. Different and correct: When ...
1
vote
1answer
409 views

Hibernate Envers audit oneToMany side too, even if it has no changes

Have two entities Instrument and Definition. When instrumentCode changed Envers create audited record only for Instrument. I want that when instrumentCode changed Envers create audited records for ...