From 6564abe4c78f24f17316d6f2f33dc3793474f1fd Mon Sep 17 00:00:00 2001 From: Jan Schatteman Date: Wed, 2 Mar 2022 23:36:10 +0100 Subject: [PATCH] Removed deprecated transactionContext() from SharedSessionBuilder Signed-off-by: Jan Schatteman --- .../java/org/hibernate/SharedSessionBuilder.java | 12 ------------ .../SessionWithSharedConnectionTest.java | 8 ++++---- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/SharedSessionBuilder.java b/hibernate-core/src/main/java/org/hibernate/SharedSessionBuilder.java index e3e3ced0b477..315110c8f646 100644 --- a/hibernate-core/src/main/java/org/hibernate/SharedSessionBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/SharedSessionBuilder.java @@ -15,18 +15,6 @@ */ public interface SharedSessionBuilder extends SessionBuilder { - /** - * Signifies that the transaction context from the original session should be used to create the new session. - * - * @return {@code this}, for method chaining - * - * @deprecated Use {@link #connection()} instead - */ - @Deprecated - default T transactionContext() { - return connection(); - } - /** * Signifies that the connection from the original session should be used to create the new session. * diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/sharedSession/SessionWithSharedConnectionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/sharedSession/SessionWithSharedConnectionTest.java index 6dc46f2cdb3a..869bcdc6e406 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/sharedSession/SessionWithSharedConnectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/sharedSession/SessionWithSharedConnectionTest.java @@ -49,7 +49,7 @@ public void testSharedTransactionContextSessionClosing(SessionFactoryScope scope session.getTransaction().begin(); Session secondSession = session.sessionWithOptions() - .transactionContext() + .connection() .openSession(); CriteriaBuilder criteriaBuilder = secondSession.getCriteriaBuilder(); CriteriaQuery criteria = criteriaBuilder.createQuery( IrrelevantEntity.class ); @@ -92,7 +92,7 @@ public void testSharedTransactionContextAutoClosing(SessionFactoryScope scope) { // COMMIT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Session secondSession = session.sessionWithOptions() - .transactionContext() + .connection() .autoClose( true ) .openSession(); @@ -116,7 +116,7 @@ public void testSharedTransactionContextAutoClosing(SessionFactoryScope scope) { session.getTransaction().begin(); secondSession = session.sessionWithOptions() - .transactionContext() + .connection() .autoClose( true ) .openSession(); @@ -160,7 +160,7 @@ public void testSharedTransactionContextFlushBeforeCompletion(SessionFactoryScop session.getTransaction().begin(); Session secondSession = session.sessionWithOptions() - .transactionContext() + .connection() // .flushBeforeCompletion( true ) .autoClose( true ) .openSession();