hibernate-envers

Javers - What are advantages of using Javers instead of Envers?

淺唱寂寞╮ 提交于 2019-12-06 11:21:45
I am developing a RESTful API using Spring Data REST. Now for auditing, Spring does have the option to auditing meta data like created_date and modified_date but they don't provide entity versioning. Currently there are two popular libraries for entity version which are Envers and Javers. I have looked over for a comparison of both but there arent any articles on this matter. So what are the benefits and drawbacks of using Javers over Envers? There are two big difference between JaVers and Envers: Envers is the Hibernate plugin. It has good integration with Hibernate but you can use it only

Audit trail with Hibernate Envers: How to trail only selected changes on entity?

六眼飞鱼酱① 提交于 2019-12-06 10:23:29
I have already implemented audit trail using hibernate envers for my entities and it works fine. Any changes (insert,update,delete) are stored in _AUD tables. Now I want to extend my audit and trail changes when one entity property has changed only. I want to store that change to additional table. In addition to the existing TABLE_AUD table which is tracking all changes in the entity, I need a second table TABLE_AUD2 that will track changes based on the one entity property only. What is important: the thing relates to the same entity. Is it possible in envers? What can you suggest to implement

Hibernate Envers with Spring using HibernateTemplate

柔情痞子 提交于 2019-12-06 06:53:41
I'm trying to setup Envers in a Spring environment. Everything works fine, when I retrieve a session manually from the SessionFactory and put everything inside a Transaction: Session session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); TestEntity test = new TestEntity(); test.setTest("REV1"); session.save(test); tx.commit(); tx = session.beginTransaction(); test.setTest("REV2"); session.save(test); tx.commit(); The above code inserts data into the TestEntity-table and also updates the AUD- and REVINFO-tables. However, when I update the table using our DAO,

Audit ManyToMany Relationships using Hibernate Envers

别来无恙 提交于 2019-12-06 05:18:24
问题 I'm using Hibernate Envers in order to audit my entities. But I have a problem. I want to audit an Entity that have a ManyToMany relationship. I found that exists an @AuditJoinTable but I don't have idea how it works. Can someone giveme an example? 回答1: Auditing many-to-many relations should work without any additional configuration, provided that both sides of the relation are audited. As to @AuditJoinTable , the annotation is used to specify a custom table name of the join table. See: http:

Hibernate Envers for Doctrine?

时光总嘲笑我的痴心妄想 提交于 2019-12-06 04:23:04
问题 Doctrine 1.x and 2 both offer some kind of Versionable support in the form of a separate auditing table that tracks changes over time. However, the versions appear to be intended for per-row use (ie, they all maintain their own version number) instead of database-wide, such as in Hibernate Envers, which gives every row a unique revision number. Does Doctrine actually provide support for that kind of behavior? I couldn't find anything online to suggest that it does. 回答1: No doctrine does not

jboss 7 (envers 4) Unable to load class org.hibernate.envers.event.AuditEventListener

余生颓废 提交于 2019-12-06 03:40:27
问题 I port from hibernate Envers 3.6 to Envers 4.0. This new version doesn't have AuditEventListener . Old version requires: listeners I can't find how to configure the new version. 回答1: In version 4.0 : <properties> <property name="hibernate.ejb.event.post-insert" value="org.hibernate.ejb.event.EJB3PostInsertEventListener,org.hibernate.envers.event.AuditEventListener" /> <property name="hibernate.ejb.event.post-update" value="org.hibernate.ejb.event.EJB3PostUpdateEventListener,org.hibernate

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

百般思念 提交于 2019-12-06 03:20:00
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.apache.tools.ant.Task and I have the sinking feeling I am doing something wrong. <target name="schemaexport" depends="init" description="Exports a generated schema to DB and file"> <taskdef name="hibernatetool" classname="org.hibernate.tool.ant

Envers: Unidirectional OneToMany without additional audit table?

那年仲夏 提交于 2019-12-06 00:16:47
问题 The following database schema: Employee[EMP_ID (PK), name, salary] Phone[ID (PK), number_str, OWNER_ID (FK)] Employee_aud[EMP_ID (PK), REV (PK/FK), REVTYPE, name, salary] Phone_aud[ID (PK), REV (PK/FK), REVTYPE, number_str] Employe_phone_aud[REV(PK/FK), OWNER_ID(PK/FK), REVTYPE(PK/FK)] can be expressed with the following Java Entities: Employee : @Entity @Audited public class Employee { @Id @GeneratedValue @Column(name = "EMP_ID") private long id; @Column private String name; @Column private

Diff on hibernate envers revisions

[亡魂溺海] 提交于 2019-12-05 23:23:18
This is a question related to: Hibernate Envers revision info (changes list) and Getting the old value and new value between two revisions with Hibernate Envers Since these questions are a few years old I would like to know if there has anything changed? Is it now possible to retrieve diffs with envers? Or do I still have to load two revisions and compare them by myself in Java? And if so - what's the best way to compare the two version in Java? Thanks. I don't think anything's changed on the Envers side 来源: https://stackoverflow.com/questions/30726464/diff-on-hibernate-envers-revisions

Can I create Hibernate Envers specific tables using Liquibase

旧街凉风 提交于 2019-12-05 05:59:50
Our Java app is Spring based and we have domain classes and the corresponding schema generated via Liquibase. We are planning to add support for a single domain to be audited. a. We don't have hibernate.xml and hibernate.cfg.xml instead we are using application-context.xml. Then how do I create audit table through annotations like @Audited. How do I solve this issue? I have added hibernate configuration as <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop> <prop key="hibernate.ejb.event.post-insert">org.hibernate.ejb