Allow use of CurrentTenantIdentifierResolver in normal session opening

Description

If I create a SessionFactory with a CurrentTenantIdentifierResolver, SessionFactoryImpl#openSession() doesn't use it. Instead it tries SessionFactory#withOptions().openSession() which causes a HibernateException:

org.hibernate.HibernateException: SessionFactory configured for multi-tenancy, but no tenant identifier specified
at org.hibernate.internal.AbstractSessionImpl.<init>(AbstractSessionImpl.java:82)
at org.hibernate.internal.SessionImpl.<init>(SessionImpl.java:234)
at org.hibernate.internal.SessionFactoryImpl$SessionBuilderImpl.openSession(SessionFactoryImpl.java:1843)
at org.hibernate.internal.SessionFactoryImpl.openSession(SessionFactoryImpl.java:1030)
[...]

Environment

None

Assignee

Steve Ebersole

Reporter

Stefan Schulze

Fix versions

Labels

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure