From 410f408f47db12398d94e9170380806ee900408a Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Tue, 6 May 2014 14:38:58 +0200 Subject: [PATCH] Upgraded Java 8 DateTime example to use Jadira UserTypes. Upgraded to Jadira Usertypes 3.2 to be able tu use Hibernate-specific UserType to make sure JDK 8 date/time types get converted into appropriate SQL types by the persistence provider. --- jpa/java8/pom.xml | 6 ++++++ .../java/example/springdata/jpa/java8/AbstractEntity.java | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/jpa/java8/pom.xml b/jpa/java8/pom.xml index 5d2561fa..981ae6d6 100644 --- a/jpa/java8/pom.xml +++ b/jpa/java8/pom.xml @@ -18,6 +18,12 @@ spring-aspects + + org.jadira.usertype + usertype.extended + 3.2.0.GA + + \ No newline at end of file diff --git a/jpa/java8/src/main/java/example/springdata/jpa/java8/AbstractEntity.java b/jpa/java8/src/main/java/example/springdata/jpa/java8/AbstractEntity.java index d625f98f..74592608 100644 --- a/jpa/java8/src/main/java/example/springdata/jpa/java8/AbstractEntity.java +++ b/jpa/java8/src/main/java/example/springdata/jpa/java8/AbstractEntity.java @@ -21,6 +21,7 @@ import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.MappedSuperclass; +import org.hibernate.annotations.Type; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; @@ -33,10 +34,10 @@ public class AbstractEntity { @Id @GeneratedValue Long id; @CreatedDate// - // @Type(type = "org.jadira.usertype.dateandtime.threetenbp.PersistentZonedDateTime")// + @Type(type = "org.jadira.usertype.dateandtime.threeten.PersistentZonedDateTime")// ZonedDateTime createdDate; @LastModifiedDate// - // @Type(type = "org.jadira.usertype.dateandtime.threetenbp.PersistentZonedDateTime")// + @Type(type = "org.jadira.usertype.dateandtime.threeten.PersistentZonedDateTime")// ZonedDateTime modifiedDate; }