From 3921de96acd0e4aa437a16ed8b928fdb91245cc2 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Tue, 6 Dec 2016 14:14:12 +0100 Subject: [PATCH] DATAJPA-1019 - Simplified test case offending Hibernate 5. Looks like the test case introduced for DATAJPA-622 introduced an invalid identifier setup which isn't tolerated on Hibernate 5 anymore. Simplified that to keep using Long identifiers to avoid the redeclaration of getId() which caused the mapping issue. --- .../sample/CustomAbstractPersistable.java | 17 +---------------- ...stomAbstractPersistableIntegrationTests.java | 5 ++--- .../CustomAbstractPersistableRepository.java | 4 +--- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/test/java/org/springframework/data/jpa/domain/sample/CustomAbstractPersistable.java b/src/test/java/org/springframework/data/jpa/domain/sample/CustomAbstractPersistable.java index 60065ca45..7f73652a9 100644 --- a/src/test/java/org/springframework/data/jpa/domain/sample/CustomAbstractPersistable.java +++ b/src/test/java/org/springframework/data/jpa/domain/sample/CustomAbstractPersistable.java @@ -15,15 +15,9 @@ */ package org.springframework.data.jpa.domain.sample; -import java.util.UUID; - -import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; import javax.persistence.Table; -import org.hibernate.annotations.GenericGenerator; import org.springframework.data.jpa.domain.AbstractPersistable; /** @@ -31,16 +25,7 @@ import org.springframework.data.jpa.domain.AbstractPersistable; */ @Entity @Table(name = "customAbstractPersistable") -public class CustomAbstractPersistable extends AbstractPersistable { +public class CustomAbstractPersistable extends AbstractPersistable { private static final long serialVersionUID = 1L; - - @Id - @Override - @GeneratedValue(generator = "uuid2") - @GenericGenerator(name = "uuid2", strategy = "uuid2") - @Column(name = "task_id", columnDefinition = "BINARY(16)") - public UUID getId() { - return super.getId(); - } } diff --git a/src/test/java/org/springframework/data/jpa/repository/CustomAbstractPersistableIntegrationTests.java b/src/test/java/org/springframework/data/jpa/repository/CustomAbstractPersistableIntegrationTests.java index 33a674406..f224273c8 100644 --- a/src/test/java/org/springframework/data/jpa/repository/CustomAbstractPersistableIntegrationTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/CustomAbstractPersistableIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 the original author or authors. + * Copyright 2014-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional; /** * @author Thomas Darimont + * @author Oliver Gierke */ @Transactional @RunWith(SpringJUnit4ClassRunner.class) @@ -45,10 +46,8 @@ public class CustomAbstractPersistableIntegrationTests { CustomAbstractPersistable entity = new CustomAbstractPersistable(); CustomAbstractPersistable saved = repository.save(entity); - CustomAbstractPersistable found = repository.findOne(saved.getId()); assertThat(found, is(saved)); } - } diff --git a/src/test/java/org/springframework/data/jpa/repository/sample/CustomAbstractPersistableRepository.java b/src/test/java/org/springframework/data/jpa/repository/sample/CustomAbstractPersistableRepository.java index fd2c875c7..8ec066191 100644 --- a/src/test/java/org/springframework/data/jpa/repository/sample/CustomAbstractPersistableRepository.java +++ b/src/test/java/org/springframework/data/jpa/repository/sample/CustomAbstractPersistableRepository.java @@ -15,8 +15,6 @@ */ package org.springframework.data.jpa.repository.sample; -import java.util.UUID; - import org.springframework.data.jpa.domain.sample.CustomAbstractPersistable; import org.springframework.data.jpa.repository.JpaRepository; @@ -24,4 +22,4 @@ import org.springframework.data.jpa.repository.JpaRepository; * @author Thomas Darimont * @author Oliver Gierke */ -public interface CustomAbstractPersistableRepository extends JpaRepository {} +public interface CustomAbstractPersistableRepository extends JpaRepository {}