From: Gustavo Martin Morcuende Date: Thu, 21 Jul 2016 17:28:52 +0000 (+0200) Subject: Spring JPA: Envers tables, auditory. X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=8539776ce79b60b9f28ffdcac98a35c3abbeb78f;p=JavaForFun Spring JPA: Envers tables, auditory. --- diff --git a/SpringJava/JPA/spring-jpa-persistence/src/main/java/de/spring/example/persistence/domain/audit/MyCustomRevision.java b/SpringJava/JPA/spring-jpa-persistence/src/main/java/de/spring/example/persistence/domain/audit/MyCustomRevision.java index 4febc39..3df9d95 100644 --- a/SpringJava/JPA/spring-jpa-persistence/src/main/java/de/spring/example/persistence/domain/audit/MyCustomRevision.java +++ b/SpringJava/JPA/spring-jpa-persistence/src/main/java/de/spring/example/persistence/domain/audit/MyCustomRevision.java @@ -1,6 +1,7 @@ package de.spring.example.persistence.domain.audit; import java.time.LocalDateTime; +import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; @@ -11,7 +12,7 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.hibernate.envers.DefaultRevisionEntity; +/** import org.hibernate.envers.DefaultRevisionEntity; **/ import org.hibernate.envers.RevisionEntity; import org.hibernate.envers.RevisionNumber; import org.hibernate.envers.RevisionTimestamp; @@ -19,7 +20,7 @@ import org.hibernate.envers.RevisionTimestamp; @Entity @RevisionEntity(MyCustomRevisionListener.class) @Table(name="CUSTOM_REVISION", schema="mybatis_example") -public class MyCustomRevision extends DefaultRevisionEntity { +public class MyCustomRevision /** extends DefaultRevisionEntity **/ { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @@ -30,7 +31,7 @@ public class MyCustomRevision extends DefaultRevisionEntity { @Column(name="REVISION_DATE") @Temporal(TemporalType.TIMESTAMP) @RevisionTimestamp - private LocalDateTime revisionDate; + private Date revisionDate; @Column(name="USERNAME") private String username; @@ -53,7 +54,7 @@ public class MyCustomRevision extends DefaultRevisionEntity { return id; } - public LocalDateTime getRevisionDate() { + public Date getRevisionDate() { return revisionDate; } diff --git a/SpringJava/JPA/spring-jpa-persistence/src/main/resources/spring-configuration/jpa-configuration.xml b/SpringJava/JPA/spring-jpa-persistence/src/main/resources/spring-configuration/jpa-configuration.xml index 6b9ae69..5c95de1 100644 --- a/SpringJava/JPA/spring-jpa-persistence/src/main/resources/spring-configuration/jpa-configuration.xml +++ b/SpringJava/JPA/spring-jpa-persistence/src/main/resources/spring-configuration/jpa-configuration.xml @@ -30,6 +30,9 @@ _AUDITED diff --git a/SpringJava/JPA/spring-jpa-persistence/src/main/resources/spring-configuration/liquibase/ddlChangelog.xml b/SpringJava/JPA/spring-jpa-persistence/src/main/resources/spring-configuration/liquibase/ddlChangelog.xml index 900271f..c903458 100644 --- a/SpringJava/JPA/spring-jpa-persistence/src/main/resources/spring-configuration/liquibase/ddlChangelog.xml +++ b/SpringJava/JPA/spring-jpa-persistence/src/main/resources/spring-configuration/liquibase/ddlChangelog.xml @@ -1,6 +1,6 @@ - + @@ -20,7 +20,34 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -44,15 +71,94 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + +