[
https://hibernate.onjira.com/browse/HHH-7305?page=com.atlassian.jira.plug...
]
Jegan commented on HHH-7305:
----------------------------
I have added a JUnit to reproduce this issue. It is the same JUnit from Hibernate, the
only difference is the line number 91 where I have explicitly set the connection release
mode to "after_statement". Running this test causes a NPE at
SettingsFactory.buildSettings method. I think, NPE in LogicalConnectionImpl comes in a JTA
environment if you do not specify a connection release mode.
The basic issue is that, connectionProvider in JdbcServices could be null in a Multi
tenant env. The fix could be to add supportsAggressiveRelease() method in
JdbcConnectionAccess class and access it from all places instead of accessing it from
ConnectionProvider. But, this may not be a right place for this method.
NPE in LogicalConnectionImpl when multi tenancy is used without
providing a release mode manually
-------------------------------------------------------------------------------------------------
Key: HHH-7305
URL:
https://hibernate.onjira.com/browse/HHH-7305
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.1.3
Environment: cfg.setProperty(Environment.MULTI_TENANT,
MultiTenancyStrategy.DATABASE.name());
Reporter: Christian kalkhoff
Priority: Critical
Attachments: SchemaBasedMultiTenancyTest.java
When multi tenancy is used and hibernate.connection.release_mode is not set, one gets a
NPE in LogicalConnectionImpl because it accesses a (non-multi-tenancy)connection provider
to determine the release mode.
Stack trace:
java.lang.NullPointerException
at
org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.determineConnectionReleaseMode(LogicalConnectionImpl.java:119)
at
org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.<init>(LogicalConnectionImpl.java:100)
at
org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.<init>(LogicalConnectionImpl.java:82)
at
org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.<init>(JdbcCoordinatorImpl.java:75)
at
org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.<init>(TransactionCoordinatorImpl.java:87)
at org.hibernate.internal.SessionImpl.<init>(SessionImpl.java:249)
at
org.hibernate.internal.SessionFactoryImpl$SessionBuilderImpl.openSession(SessionFactoryImpl.java:1835)
...
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira