Skip to content

Commit e4c0634

Browse files
committed
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.
1 parent 1929994 commit e4c0634

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed

src/test/java/org/springframework/data/jpa/domain/sample/CustomAbstractPersistable.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,17 @@
1515
*/
1616
package org.springframework.data.jpa.domain.sample;
1717

18-
import java.util.UUID;
19-
20-
import javax.persistence.Column;
2118
import javax.persistence.Entity;
22-
import javax.persistence.GeneratedValue;
23-
import javax.persistence.Id;
2419
import javax.persistence.Table;
2520

26-
import org.hibernate.annotations.GenericGenerator;
2721
import org.springframework.data.jpa.domain.AbstractPersistable;
2822

2923
/**
3024
* @author Thomas Darimont
3125
*/
3226
@Entity
3327
@Table(name = "customAbstractPersistable")
34-
public class CustomAbstractPersistable extends AbstractPersistable<UUID> {
28+
public class CustomAbstractPersistable extends AbstractPersistable<Long> {
3529

3630
private static final long serialVersionUID = 1L;
37-
38-
@Id
39-
@Override
40-
@GeneratedValue(generator = "uuid2")
41-
@GenericGenerator(name = "uuid2", strategy = "uuid2")
42-
@Column(name = "task_id", columnDefinition = "BINARY(16)")
43-
public UUID getId() {
44-
return super.getId();
45-
}
4631
}

src/test/java/org/springframework/data/jpa/repository/CustomAbstractPersistableIntegrationTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014 the original author or authors.
2+
* Copyright 2014-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@
2929

3030
/**
3131
* @author Thomas Darimont
32+
* @author Oliver Gierke
3233
*/
3334
@Transactional
3435
@RunWith(SpringJUnit4ClassRunner.class)
@@ -45,10 +46,8 @@ public void shouldBeAbleToSaveAndLoadCustomPersistableWithUuidId() {
4546

4647
CustomAbstractPersistable entity = new CustomAbstractPersistable();
4748
CustomAbstractPersistable saved = repository.save(entity);
48-
4949
CustomAbstractPersistable found = repository.findOne(saved.getId());
5050

5151
assertThat(found, is(saved));
5252
}
53-
5453
}

src/test/java/org/springframework/data/jpa/repository/sample/CustomAbstractPersistableRepository.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@
1515
*/
1616
package org.springframework.data.jpa.repository.sample;
1717

18-
import java.util.UUID;
19-
2018
import org.springframework.data.jpa.domain.sample.CustomAbstractPersistable;
2119
import org.springframework.data.jpa.repository.JpaRepository;
2220

2321
/**
2422
* @author Thomas Darimont
2523
* @author Oliver Gierke
2624
*/
27-
public interface CustomAbstractPersistableRepository extends JpaRepository<CustomAbstractPersistable, UUID> {}
25+
public interface CustomAbstractPersistableRepository extends JpaRepository<CustomAbstractPersistable, Long> {}

0 commit comments

Comments
 (0)