From 65d524e3198e58970064159865fe482d9c92d2fa Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Thu, 4 Aug 2022 09:24:56 +0200 Subject: [PATCH] Upgrade to Hibernate 6.1.2. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Re-enable test cases that were previously running into HHH-15389 [0]. Filed an explicit ticket for the broken access of the sort definitions in HHH-15432 [1]. Disabled EntityGraphRepositoryMethodsIntegrationTests.shouldCreateDynamicGraphWithMultipleLevelsOfSubgraphs(…) as Hibernate now apparently behaves different for application of nested paths in fetch graphs. Likely a side effect of the fix for HHH-15391 [2]. Removed obsolete method in PartTreeJpaQueryIntegrationTests. Fixes #2615. [0] https://hibernate.atlassian.net/browse/HHH-15389 [1] https://hibernate.atlassian.net/browse/HHH-15432 [2] https://hibernate.atlassian.net/browse/HHH-15391 --- pom.xml | 2 +- ...raphRepositoryMethodsIntegrationTests.java | 2 ++ .../repository/UserRepositoryFinderTests.java | 10 ------- .../PartTreeJpaQueryIntegrationTests.java | 28 +++---------------- 4 files changed, 7 insertions(+), 35 deletions(-) diff --git a/pom.xml b/pom.xml index 8a1565932..1bb0a1c43 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ 3.0.2 - 6.1.1.Final + 6.1.2.Final 4.3 8.0.23 42.2.19 diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/EntityGraphRepositoryMethodsIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/EntityGraphRepositoryMethodsIntegrationTests.java index 0e3254370..ba817878b 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/EntityGraphRepositoryMethodsIntegrationTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/EntityGraphRepositoryMethodsIntegrationTests.java @@ -31,6 +31,7 @@ import java.util.List; import org.assertj.core.api.SoftAssertions; import org.junit.Assume; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; @@ -252,6 +253,7 @@ public class EntityGraphRepositoryMethodsIntegrationTests { } @Test // DATAJPA-1041, DATAJPA-1075 + @Disabled // likely broken due to the fixes made for HHH-15391 void shouldCreateDynamicGraphWithMultipleLevelsOfSubgraphs() { Assume.assumeTrue(currentEntityManagerIsAJpa21EntityManager(em)); diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/UserRepositoryFinderTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/UserRepositoryFinderTests.java index 3241a237f..2046127ef 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/UserRepositoryFinderTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/UserRepositoryFinderTests.java @@ -16,7 +16,6 @@ package org.springframework.data.jpa.repository; import static org.assertj.core.api.Assertions.*; -import static org.junit.Assume.*; import static org.springframework.data.domain.Sort.Direction.*; import jakarta.persistence.EntityManager; @@ -235,9 +234,6 @@ public class UserRepositoryFinderTests { @Test // DATAJPA-1519 void escapingInLikeSpels() { - // HHH-15392 - assumeFalse(provider.equals(PersistenceProvider.HIBERNATE)); - User extra = new User("extra", "Matt_ew", "extra"); userRepository.save(extra); @@ -248,9 +244,6 @@ public class UserRepositoryFinderTests { @Test // DATAJPA-1522 void escapingInLikeSpelsInThePresenceOfEscapeCharacters() { - // HHH-15392 - assumeFalse(provider.equals(PersistenceProvider.HIBERNATE)); - User withEscapeCharacter = userRepository.save(new User("extra", "Matt\\xew", "extra1")); userRepository.save(new User("extra", "Matt\\_ew", "extra2")); @@ -260,9 +253,6 @@ public class UserRepositoryFinderTests { @Test // DATAJPA-1522 void escapingInLikeSpelsInThePresenceOfEscapedWildcards() { - // HHH-15392 - assumeFalse(provider.equals(PersistenceProvider.HIBERNATE)); - userRepository.save(new User("extra", "Matt\\xew", "extra1")); User withEscapedWildcard = userRepository.save(new User("extra", "Matt\\_ew", "extra2")); diff --git a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/PartTreeJpaQueryIntegrationTests.java b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/PartTreeJpaQueryIntegrationTests.java index 980cef7b4..b002b07be 100644 --- a/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/PartTreeJpaQueryIntegrationTests.java +++ b/spring-data-jpa/src/test/java/org/springframework/data/jpa/repository/query/PartTreeJpaQueryIntegrationTests.java @@ -18,7 +18,6 @@ import org.springframework.aop.framework.Advised; package org.springframework.data.jpa.repository.query; import static org.assertj.core.api.Assertions.*; -import static org.springframework.test.util.ReflectionTestUtils.*; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; @@ -26,10 +25,8 @@ import jakarta.persistence.Query; import jakarta.persistence.TemporalType; import java.lang.reflect.Method; -import java.util.Arrays; import java.util.Collection; import java.util.Date; -import java.util.Iterator; import java.util.List; import org.hibernate.Version; @@ -50,7 +47,6 @@ import org.springframework.data.repository.core.support.DefaultRepositoryMetadat import org.springframework.data.repository.query.Param; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.util.Assert; /** * Integration tests for {@link PartTreeJpaQuery}. @@ -101,7 +97,7 @@ public class PartTreeJpaQueryIntegrationTests { } @Test // DATAJPA-121 - @Disabled // HHH-15389 + @Disabled // HHH-15432 void recreatesQueryIfNullValueIsGiven() throws Exception { JpaQueryMethod queryMethod = getQueryMethod("findByFirstname", String.class, Pageable.class); @@ -128,7 +124,7 @@ public class PartTreeJpaQueryIntegrationTests { } @Test // DATAJPA-920 - @Disabled // HHH-15389 + @Disabled // HHH-15432 void shouldSelectAliasedIdForExistsProjectionQueries() throws Exception { JpaQueryMethod queryMethod = getQueryMethod("existsByFirstname", String.class); @@ -140,7 +136,7 @@ public class PartTreeJpaQueryIntegrationTests { } @Test // DATAJPA-1074 - @Disabled // HHH-15389 + @Disabled // HHH-15432 void isEmptyCollection() throws Exception { JpaQueryMethod queryMethod = getQueryMethod("findByRolesIsEmpty"); @@ -152,7 +148,7 @@ public class PartTreeJpaQueryIntegrationTests { } @Test // DATAJPA-1074 - @Disabled // HHH-15389 + @Disabled // HHH-15432 void isNotEmptyCollection() throws Exception { JpaQueryMethod queryMethod = getQueryMethod("findByRolesIsNotEmpty"); @@ -251,22 +247,6 @@ public class PartTreeJpaQueryIntegrationTests { new SpelAwareProxyProjectionFactory(), PersistenceProvider.fromEntityManager(entityManager)); } - @SuppressWarnings("unchecked") - private static T getValue(Object source, String path) { - - Iterator split = Arrays.asList(path.split("\\.")).iterator(); - Object result = source; - - while (split.hasNext()) { - - Assert.notNull(result, "result must not be null"); - result = getField(result, split.next()); - } - - Assert.notNull(result, "result must not be null"); - return (T) result; - } - private JpaParametersParameterAccessor getAccessor(JpaQueryMethod queryMethod, Object[] values) { return new JpaParametersParameterAccessor(queryMethod.getParameters(), values); }