Skip to content

Commit 812d3f6

Browse files
committed
HHH-7974 - Session.getTenantIdentifier() not callable without active transaction
(cherry picked from commit d9aa9d3)
1 parent 772f3cb commit 812d3f6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

hibernate-core/src/main/java/org/hibernate/context/internal/ThreadLocalSessionContext.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ else if ( "toString".equals( methodName )
319319
|| "hashCode".equals( methodName )
320320
|| "getStatistics".equals( methodName )
321321
|| "isOpen".equals( methodName )
322-
|| "getListeners".equals( methodName ) //useful for HSearch in particular
322+
|| "getListeners".equals( methodName )
323323
) {
324324
// allow these to go through the the real session no matter what
325325
}
@@ -333,15 +333,15 @@ else if ( !realSession.isOpen() ) {
333333
else if ( !realSession.getTransaction().isActive() ) {
334334
// limit the methods available if no transaction is active
335335
if ( "beginTransaction".equals( methodName )
336-
|| "getTransaction".equals( methodName )
337-
|| "isTransactionInProgress".equals( methodName )
338-
|| "setFlushMode".equals( methodName )
339-
|| "getFactory".equals( methodName ) //from SessionImplementor
340-
|| "getSessionFactory".equals( methodName ) ) {
336+
|| "getTransaction".equals( methodName )
337+
|| "isTransactionInProgress".equals( methodName )
338+
|| "setFlushMode".equals( methodName )
339+
|| "getFactory".equals( methodName )
340+
|| "getSessionFactory".equals( methodName )
341+
|| "getTenantIdentifier".equals( methodName ) ) {
341342
LOG.tracev( "Allowing method [{0}] in non-transacted context", methodName );
342343
}
343-
else if ( "reconnect".equals( methodName )
344-
|| "disconnect".equals( methodName ) ) {
344+
else if ( "reconnect".equals( methodName ) || "disconnect".equals( methodName ) ) {
345345
// allow these (deprecated) methods to pass through
346346
}
347347
else {

0 commit comments

Comments
 (0)