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.
This commit is contained in:
@@ -18,6 +18,12 @@
|
||||
<artifactId>spring-aspects</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jadira.usertype</groupId>
|
||||
<artifactId>usertype.extended</artifactId>
|
||||
<version>3.2.0.GA</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user