HHH-12830 Improve error message when a method is called in a non active

transaction
This commit is contained in:
nikowitt 2018-07-19 12:15:31 +02:00 committed by Guillaume Smet
parent cc600abf38
commit c17a83cc0d
1 changed files with 2 additions and 1 deletions

View File

@ -342,7 +342,8 @@ public class ThreadLocalSessionContext extends AbstractCurrentSessionContext {
LOG.tracef( "Allowing invocation [%s] to proceed to real (non-transacted) session - deprecated methods", methodName ); LOG.tracef( "Allowing invocation [%s] to proceed to real (non-transacted) session - deprecated methods", methodName );
} }
else { else {
throw new HibernateException( methodName + " is not valid without active transaction" ); throw new HibernateException( "Calling method '" + methodName + "' is not valid without an active transaction (Current status: "
+ realSession.getTransaction().getStatus() + ")" );
} }
} }
LOG.tracef( "Allowing proxy invocation [%s] to proceed to real session", methodName ); LOG.tracef( "Allowing proxy invocation [%s] to proceed to real session", methodName );