hibernate-envers

Hibernate envers forRevisionsOfEntityWithChanges only returning last modified column

南笙酒味 提交于 2021-01-07 06:57:47
问题 AuditReader reader = AuditReaderFactory.get(entityManager); AuditQuery query = reader.createQuery().forRevisionsOfEntityWithChanges(Customer.class, false); List<Object[]> revisionsCustomer = query .add(AuditEntity.id().eq(3014l)) .addOrder(AuditEntity.revisionProperty("timestamp").desc()) .getResultList(); I have edited the instance with id 3014 4 times. Each time editing a different column. But in revisionsCustomer it shows that every time I have changed the same column (the one I have

not to create revision for particular column change

自古美人都是妖i 提交于 2020-12-13 00:45:48
问题 I have a model that is audited and there is a column in it that I have to update periodically. Bu I don't want to create revision for every change of this column. Is there any configuration for not to create revision even if the property X's been changed? 回答1: The only out-of-the-box way to do what you ask is to implement Conditional Auditing . The conditional auditing approach described in the documentation requires that users provide their own event listeners and add your various if-checks

not to create revision for particular column change

ⅰ亾dé卋堺 提交于 2020-12-13 00:45:13
问题 I have a model that is audited and there is a column in it that I have to update periodically. Bu I don't want to create revision for every change of this column. Is there any configuration for not to create revision even if the property X's been changed? 回答1: The only out-of-the-box way to do what you ask is to implement Conditional Auditing . The conditional auditing approach described in the documentation requires that users provide their own event listeners and add your various if-checks

How to disable envers auditing for spring boot

折月煮酒 提交于 2020-06-16 07:50:09
问题 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 , how i can keep my code intact (means ,without changing or removing @Audited annotation) , how to enable or disable envers auditing at run time or compile time, because after everything i have tried auditing is working for both api i have tried spring.jpa.properties.hibernate.integration.envers

How to disable envers auditing for spring boot

[亡魂溺海] 提交于 2020-06-16 07:49:06
问题 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 , how i can keep my code intact (means ,without changing or removing @Audited annotation) , how to enable or disable envers auditing at run time or compile time, because after everything i have tried auditing is working for both api i have tried spring.jpa.properties.hibernate.integration.envers

Spring Boot 2 - disable Envers

老子叫甜甜 提交于 2020-02-25 11:03:00
问题 How can I disable Hibernate Envers in Spring Boot 2? I don't want to remove the dependency, because the code relies on it depending on the environment. I tried the following properties in my application.properties but none worked. On startup it always prints envers enabled = true spring.hibernate.integration.envers.enabled=false hibernate.integration.envers.enabled=false spring.jpa.hibernate.integration.envers.enabled=false 回答1: Can you try; spring.jpa.properties.hibernate.integration.envers

Spring Boot 2 - disable Envers

流过昼夜 提交于 2020-02-25 11:02:41
问题 How can I disable Hibernate Envers in Spring Boot 2? I don't want to remove the dependency, because the code relies on it depending on the environment. I tried the following properties in my application.properties but none worked. On startup it always prints envers enabled = true spring.hibernate.integration.envers.enabled=false hibernate.integration.envers.enabled=false spring.jpa.hibernate.integration.envers.enabled=false 回答1: Can you try; spring.jpa.properties.hibernate.integration.envers

Ways to pass additional data to Custom RevisionEntity in Hibernate Envers?

China☆狼群 提交于 2020-02-02 03:46:22
问题 It's RESTful web app. I am using Hibernate Envers to store historical data. Along with revision number and timestamp, I also need to store other details (for example: IP address and authenticated user). Envers provides multiple ways to have a custom revision entity which is awesome. I am facing problem in setting the custom data on the revision entity. @RevisionEntity( MyCustomRevisionListener.class ) public class MyCustomRevisionEntity extends DefaultRevisionEntity { private String userName;

Hibernate Envers: prevent version on onPostDelete

我们两清 提交于 2020-01-16 19:36:11
问题 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 inserted without calling onPostUpdate Event of Envers. pom.xml: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0

Hibernate Envers: prevent version on onPostDelete

拥有回忆 提交于 2020-01-16 19:36:07
问题 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 inserted without calling onPostUpdate Event of Envers. pom.xml: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0