From e210234d98aab2a67f2d6bf31d57604bfd7ea410 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Mon, 5 Feb 2024 12:51:45 -0500 Subject: [PATCH] Upgrade to Hibernate `6.2.22.Final` * Fix JPA test for the latest Hibernate --- build.gradle | 2 +- .../integration/jpa/core/HibernateJpaOperationsTests.java | 3 +-- .../org/springframework/integration/jpa/dsl/JpaTests.java | 3 +-- .../jpa/outbound/JpaOutboundChannelAdapterTests.java | 6 +++--- .../JpaOutboundChannelAdapterTransactionalTests.java | 4 ++-- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 70092943f2..310ddca44c 100644 --- a/build.gradle +++ b/build.gradle @@ -66,7 +66,7 @@ ext { groovyVersion = '4.0.18' hamcrestVersion = '2.2' hazelcastVersion = '5.2.4' - hibernateVersion = '6.2.13.Final' + hibernateVersion = '6.2.22.Final' hsqldbVersion = '2.7.2' h2Version = '2.2.224' jacksonVersion = '2.15.3' diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/core/HibernateJpaOperationsTests.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/core/HibernateJpaOperationsTests.java index 46e4a9477c..78436dd4eb 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/core/HibernateJpaOperationsTests.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/core/HibernateJpaOperationsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -207,7 +207,6 @@ public class HibernateJpaOperationsTests { entityManager.flush(); assertThat(savedStudent).isNotNull(); assertThat(savedStudent.getRollNumber()).isNotNull(); - assertThat(student.getRollNumber()).isEqualTo(savedStudent.getRollNumber()); assertThat(student != savedStudent).isTrue(); } diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/dsl/JpaTests.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/dsl/JpaTests.java index 8dc50ddd71..dfff5b0167 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/dsl/JpaTests.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/dsl/JpaTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 the original author or authors. + * Copyright 2016-2024 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. @@ -166,7 +166,6 @@ public class JpaTests { StudentDomain mergedStudent = (StudentDomain) receive.getPayload(); assertThat(mergedStudent.getFirstName()).isEqualTo(student.getFirstName()); assertThat(mergedStudent.getRollNumber()).isNotNull(); - assertThat(student.getRollNumber()).isEqualTo(mergedStudent.getRollNumber()); } @Test diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundChannelAdapterTests.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundChannelAdapterTests.java index a6a28bc964..d597160fe7 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundChannelAdapterTests.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -102,7 +102,7 @@ public class JpaOutboundChannelAdapterTests { List results2 = this.jdbcTemplate.queryForList("Select * from Student"); assertThat(results2).hasSize(4); - assertThat(testStudent.getRollNumber()).isNotNull(); + assertThat(results2.get(0)).extracting("rollNumber").isNotNull(); } @Test @@ -134,7 +134,7 @@ public class JpaOutboundChannelAdapterTests { List results2 = this.jdbcTemplate.queryForList("Select * from Student"); assertThat(results2).hasSize(4); - assertThat(testStudent.getRollNumber()).isNotNull(); + assertThat(results2.get(0)).extracting("rollNumber").isNotNull(); } @Test diff --git a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundChannelAdapterTransactionalTests.java b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundChannelAdapterTransactionalTests.java index 32a5f81812..f618ccf217 100644 --- a/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundChannelAdapterTransactionalTests.java +++ b/spring-integration-jpa/src/test/java/org/springframework/integration/jpa/outbound/JpaOutboundChannelAdapterTransactionalTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -72,7 +72,7 @@ public class JpaOutboundChannelAdapterTransactionalTests { .queryForList("Select * from Student"); assertThat(results2).hasSize(4); - assertThat(testStudent.getRollNumber()).isNotNull(); + assertThat(results2.get(0)).extracting("rollNumber").isNotNull(); } }