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.
This commit is contained in:
Oliver Gierke
2016-12-06 14:14:12 +01:00
parent 2eada61148
commit 3921de96ac
3 changed files with 4 additions and 22 deletions

View File

@@ -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<UUID> {
public class CustomAbstractPersistable extends AbstractPersistable<Long> {
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();
}
}

View File

@@ -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));
}
}

View File

@@ -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<CustomAbstractPersistable, UUID> {}
public interface CustomAbstractPersistableRepository extends JpaRepository<CustomAbstractPersistable, Long> {}