hibernate-envers

Hibernate Envers how to get the log history properly?

巧了我就是萌 提交于 2021-02-08 10:13:11
问题 i create a table audit log using Hibernate Envers, and i use Spring Data Envers as my library, when i save/update/delete it successfully saved the log in my autid_log table, but when i want to retrive the log data, i got infinite loop of error, how can i do this properly? here is my code : Here is my controller : @GetMapping("/getPartnerRelationshipLog/{partnerId}") public ResponseEntity<?> getPartnerRelationshipLog(@PathVariable Long partnerId) { // Long id = partner.getId(); Revisions

the hibernate-envers with liquibase

[亡魂溺海] 提交于 2021-02-07 19:22:35
问题 My question can be trival, but documentation for hibernate-envers say I need just 2 steps to make hibernate envers work: the hibernate-envers jar on the classpath, an @Audited annotation on the entity. First of all I added: <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-envers</artifactId> <version>5.2.12.Final</version> </dependency> Second I added @Audited annotation above my entity: @Entity @Audited @Table(name = "users") public class User {...} After those 2 steps I

Hibernate envers creating a record when no changes

与世无争的帅哥 提交于 2021-02-07 10:20:03
问题 I've been searching a way to make envers not recording any entity that I merged when there were no modification since last record. I turns out that this should be Envers' normal behavior (no audit if there are no modifications). Entities only have the @Audited annotations, but they keep being audited even when there is no change since last audit. This is the configuration of my persitence.xml : <property name="org.hibernate.envers.revision_field_name" value="revision" /> <property name="org

Hibernate envers creating a record when no changes

余生长醉 提交于 2021-02-07 10:18:17
问题 I've been searching a way to make envers not recording any entity that I merged when there were no modification since last record. I turns out that this should be Envers' normal behavior (no audit if there are no modifications). Entities only have the @Audited annotations, but they keep being audited even when there is no change since last audit. This is the configuration of my persitence.xml : <property name="org.hibernate.envers.revision_field_name" value="revision" /> <property name="org

mysql: keep auto-increment counter after server restart - inconsistent envers audit tables

拟墨画扇 提交于 2021-02-06 14:01:55
问题 I'm using InnoDb schema on mysql 5.5 . mysql 5.5 guide states: InnoDB uses the in-memory auto-increment counter as long as the server runs. When the server is stopped and restarted, InnoDB reinitializes the counter for each table for the first INSERT to the table, as described earlier. This is a big problem for me. I'm using envers to keep entities audits. I get as many errors as many "last rows" I delete. Suppose I'm starting insert data into an empty table. Suppose to insert 10 rows. Then

mysql: keep auto-increment counter after server restart - inconsistent envers audit tables

China☆狼群 提交于 2021-02-06 14:01:35
问题 I'm using InnoDb schema on mysql 5.5 . mysql 5.5 guide states: InnoDB uses the in-memory auto-increment counter as long as the server runs. When the server is stopped and restarted, InnoDB reinitializes the counter for each table for the first INSERT to the table, as described earlier. This is a big problem for me. I'm using envers to keep entities audits. I get as many errors as many "last rows" I delete. Suppose I'm starting insert data into an empty table. Suppose to insert 10 rows. Then

mysql: keep auto-increment counter after server restart - inconsistent envers audit tables

痞子三分冷 提交于 2021-02-06 14:00:39
问题 I'm using InnoDb schema on mysql 5.5 . mysql 5.5 guide states: InnoDB uses the in-memory auto-increment counter as long as the server runs. When the server is stopped and restarted, InnoDB reinitializes the counter for each table for the first INSERT to the table, as described earlier. This is a big problem for me. I'm using envers to keep entities audits. I get as many errors as many "last rows" I delete. Suppose I'm starting insert data into an empty table. Suppose to insert 10 rows. Then

Hibernate audit log of fields' change

若如初见. 提交于 2021-02-04 18:36:46
问题 How can I log the changes of the entity into log files? Consider I have Person like this. import org.hibernate.envers.Audited; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.GeneratedValue; import javax.persistence.Column; @Entity @Audited public class Person { @Id @GeneratedValue private int id; private String name; private String surname; // add getters, setters, constructors, equals and hashCode here } and a code of changing existing Person Person p1

How to find all revisions for an entity using spring data envers?

血红的双手。 提交于 2021-01-27 01:47:19
问题 I am using spring-data-envers in my spring boot application. I can successfully log the audits on my entities. Now, I need to show audited data to the user in UI. Like there will be search form where user can select duration and entity for which he wants to see audit logs. RevisionRepository provided by string-data-envers has only three methods as follows. @NoRepositoryBean public interface RevisionRepository<T, ID extends Serializable, N extends Number & Comparable<N>> { /** * Returns the

How to find all revisions for an entity using spring data envers?

半世苍凉 提交于 2021-01-27 01:42:08
问题 I am using spring-data-envers in my spring boot application. I can successfully log the audits on my entities. Now, I need to show audited data to the user in UI. Like there will be search form where user can select duration and entity for which he wants to see audit logs. RevisionRepository provided by string-data-envers has only three methods as follows. @NoRepositoryBean public interface RevisionRepository<T, ID extends Serializable, N extends Number & Comparable<N>> { /** * Returns the