Skip to content

Commit 1fc9c25

Browse files
committed
Set up entity load graph test according to what's required by Hibernate 6.
As recommended in [0], we now set up our integration tests verifying the application of entity load graphs using a lazy @manytoone relationship. [0] https://hibernate.atlassian.net/browse/HHH-15391 Related to #2423.
1 parent c51d32c commit 1fc9c25

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

Diff for: spring-data-jpa/src/test/java/org/springframework/data/jpa/domain/sample/User.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@
9292
@Table(name = "SD_User")
9393
public class User {
9494

95-
@Id
96-
@GeneratedValue(strategy = GenerationType.AUTO) private Integer id;
95+
@Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id;
9796
private String firstname;
9897
private String lastname;
9998
private int age;
@@ -106,7 +105,7 @@ public class User {
106105

107106
@ManyToMany private Set<Role> roles;
108107

109-
@ManyToOne private User manager;
108+
@ManyToOne(fetch = FetchType.LAZY) private User manager;
110109

111110
@Embedded private Address address;
112111

@@ -372,7 +371,7 @@ public boolean equals(Object obj) {
372371

373372
User that = (User) obj;
374373

375-
if (null == this.getId() || null == that.getId()) {
374+
if ((null == this.getId()) || (null == that.getId())) {
376375
return false;
377376
}
378377

Diff for: spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/EntityGraphRepositoryMethodsIntegrationTests.java

-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.assertj.core.api.SoftAssertions;
3232
import org.junit.Assume;
3333
import org.junit.jupiter.api.BeforeEach;
34-
import org.junit.jupiter.api.Disabled;
3534
import org.junit.jupiter.api.Test;
3635
import org.junit.jupiter.api.extension.ExtendWith;
3736
import org.springframework.beans.factory.annotation.Autowired;
@@ -94,7 +93,6 @@ void setup() {
9493
}
9594

9695
@Test // DATAJPA-612
97-
@Disabled // HHH-15391
9896
void shouldRespectConfiguredJpaEntityGraph() {
9997

10098
Assume.assumeTrue(currentEntityManagerIsAJpa21EntityManager(em));

0 commit comments

Comments
 (0)