From eec7b8ab11c0b6a2798e05d918bb1069c5567cb7 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Wed, 20 Nov 2024 23:26:00 +0100 Subject: [PATCH] fix tests which were asserting stuff about JPA compliance for a non-JPA method The JPA spec does not have anything to say about our beginTransaction() method --- .../jta/JpaComplianceAlreadyStartedTransactionTest.java | 3 ++- .../jta/NonJpaComplianceAlreadyStartedTransactionTest.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/resource/transaction/jta/JpaComplianceAlreadyStartedTransactionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/resource/transaction/jta/JpaComplianceAlreadyStartedTransactionTest.java index f0ca7aabf9..8e7bc38d9d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/resource/transaction/jta/JpaComplianceAlreadyStartedTransactionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/resource/transaction/jta/JpaComplianceAlreadyStartedTransactionTest.java @@ -45,7 +45,8 @@ public class JpaComplianceAlreadyStartedTransactionTest extends BaseNonConfigCor Transaction tx = null; try { // A call to begin() with an active Tx should cause an IllegalStateException - tx = s.beginTransaction(); + tx = s.getTransaction(); + tx.begin(); } catch (Exception e) { if ( tx != null && tx.isActive() ) { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/resource/transaction/jta/NonJpaComplianceAlreadyStartedTransactionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/resource/transaction/jta/NonJpaComplianceAlreadyStartedTransactionTest.java index a0e51a4368..5b27adf226 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/resource/transaction/jta/NonJpaComplianceAlreadyStartedTransactionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/resource/transaction/jta/NonJpaComplianceAlreadyStartedTransactionTest.java @@ -50,7 +50,8 @@ public class NonJpaComplianceAlreadyStartedTransactionTest extends BaseNonConfig public void noIllegalStateExceptionShouldBeThrownWhenBeginTxIsCalledWithAnAlreadyActiveTx() throws Exception { tm.begin(); try (Session s = openSession()) { - Transaction tx = s.beginTransaction(); + Transaction tx = s.getTransaction(); + tx.begin(); try { s.persist( new TestEntity( "ABC" ) ); tx.commit();