Skip to content

Commit cef1fa2

Browse files
committed
4.x: Tests fail when upgrading to Hibernate 6.6.23.Final #10441
Signed-off-by: Jorge Bescos Gascon <[email protected]>
1 parent 80be146 commit cef1fa2

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

dependencies/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
<version.lib.h2>2.2.220</version.lib.h2>
6868
<version.lib.hamcrest>1.3</version.lib.hamcrest>
6969
<version.lib.handlebars>4.4.0</version.lib.handlebars>
70-
<version.lib.hibernate.family>6.3</version.lib.hibernate.family>
71-
<version.lib.hibernate>${version.lib.hibernate.family}.1.Final</version.lib.hibernate>
70+
<version.lib.hibernate.family>6.6</version.lib.hibernate.family>
71+
<version.lib.hibernate>${version.lib.hibernate.family}.23.Final</version.lib.hibernate>
7272
<version.lib.hibernate-validator>8.0.2.Final</version.lib.hibernate-validator>
7373
<version.lib.hikaricp>5.0.1</version.lib.hikaricp>
7474
<version.lib.hystrix>1.5.18</version.lib.hystrix>

integrations/cdi/jpa-cdi/src/test/java/io/helidon/integrations/cdi/jpa/chirp/TestJpaTransactionScopedSynchronizedEntityManager.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2019, 2025 Oracle and/or its affiliates.
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.
@@ -292,9 +292,9 @@ void testJpaTransactionScopedSynchronizedEntityManager()
292292
assertThat(transactionScopedContext.isActive(), is(true));
293293

294294
// Remove the Author we successfully committed before. We
295-
// have to merge because author1 became detached a few lines
296-
// above.
297-
author1 = em.merge(author1);
295+
// have to find because author1 became detached a few lines
296+
// above and it is not allowed to attach it again with merge.
297+
author1 = em.find(Author.class, Integer.valueOf(1));
298298
assertThat(author1, notNullValue());
299299
assertThat(em.contains(author1), is(true));
300300
em.remove(author1);
@@ -313,13 +313,15 @@ void testJpaTransactionScopedSynchronizedEntityManager()
313313
// tables.
314314
assertTableRowCount(dataSource, "AUTHOR", 0);
315315

316-
// Start a new transaction, merge our detached author1, and
316+
// Start a new transaction, persist our detached author1, and
317317
// commit. This will bump the author's ID and put a row in
318318
// the database.
319319
tm.begin();
320320
assertThat(em.isJoinedToTransaction(), is(true));
321321
assertThat(transactionScopedContext.isActive(), is(true));
322-
author1 = em.merge(author1);
322+
author1 = new Author("Abraham Lincoln");
323+
em.persist(author1);
324+
em.merge(author1);
323325
tm.commit();
324326
assertThat(em.isJoinedToTransaction(), is(false));
325327
assertThat(em.contains(author1), is(false));

integrations/cdi/jpa-cdi/src/test/java/io/helidon/integrations/cdi/jpa/chirp/TestRollbackScenarios.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2019, 2025 Oracle and/or its affiliates.
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.
@@ -276,6 +276,8 @@ void testRollbackScenarios()
276276
assertThat(tm.getStatus(), is(Status.STATUS_ACTIVE));
277277
assertThat(em.isJoinedToTransaction(), is(true));
278278
assertThat(em.contains(author), is(false));
279+
author = new Author("John Kennedy");
280+
em.persist(author);
279281
author = em.merge(author);
280282
em.remove(author);
281283
tm.commit();

0 commit comments

Comments
 (0)