#45 - Removed Jadira user types in favor of new JPA 2.1 AttributeConverters.

We now activate the JSR-310 AttributeConverters shipped with Spring Data JPA 1.8. Removed the dependency to Jadira user types and switch to non-time-zoned Java 8 LocalDateTime.

Original pull request: #46.
This commit is contained in:
Oliver Gierke
2014-12-30 17:34:31 +01:00
parent e953f6d5e5
commit 7f3339a610
3 changed files with 7 additions and 16 deletions

View File

@@ -13,16 +13,10 @@
<dependencies>
<dependency>
<groupId>org.jadira.usertype</groupId>
<artifactId>usertype.extended</artifactId>
<version>3.2.0.GA</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.8.0.DATAJPA-650-SNAPSHOT</version>
<version>1.8.0.BUILD-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -15,13 +15,12 @@
*/
package example.springdata.jpa.java8;
import java.time.ZonedDateTime;
import java.time.LocalDateTime;
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,11 +32,6 @@ public class AbstractEntity {
@Id @GeneratedValue Long id;
@CreatedDate//
@Type(type = "org.jadira.usertype.dateandtime.threeten.PersistentZonedDateTime")//
ZonedDateTime createdDate;
@LastModifiedDate//
@Type(type = "org.jadira.usertype.dateandtime.threeten.PersistentZonedDateTime")//
ZonedDateTime modifiedDate;
@CreatedDate LocalDateTime createdDate;
@LastModifiedDate LocalDateTime modifiedDate;
}

View File

@@ -16,11 +16,14 @@
package example.springdata.jpa.java8;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.orm.jpa.EntityScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.domain.support.Jsr310JpaConverters;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
@Configuration
@EnableAutoConfiguration
@EntityScan(basePackageClasses = { AuditingConfiguration.class, Jsr310JpaConverters.class })
@EnableJpaAuditing
class AuditingConfiguration {