Currently, this affects at least these tests:
FilterInheritanceTest on Sybase 16
InsertOrderingWithJoinedTableInheritance on Sybase 16
We need to make sure an unexpected exception doesn't lead to leaking an open Session, because such session causes a freeze when cleaning up the SessionFactory.
The cleanupTestData method of BaseNonConfigCoreFunctionalTestCase needs a similar change too.
The failures in mentioned tests are caused by HHH-11262, this issue's purpose is to be a workaround so that they don't hang the TS, they will still fail after this fix, if is not fixed.