[hibernate-dev] Multitenancy Per Schema Fails With NPE

Steve Ebersole steve at hibernate.org
Wed Apr 22 09:48:44 EDT 2015


1) This is a list for discussing the development of Hibernate itself, not
for discussing usage of Hibernate.  Please use the forums, StackOverflow,
or #hibernate IRC for user questions.

2) If this really leads to a NPE in *Hibernate* (not your code) trying to
open a connection, then that would be a bug.  If that is the case, please
open a Jira, and be sure to include (a) a test case and (b) the full stack
trace for the NPE.
On Apr 22, 2015 7:07 AM, "amit shah" <amits.84 at gmail.com> wrote:

> I'm using schema based multi-tenancy providing implementations for both
> MultiTenantConnectionProvider & CurrentTenantIdentifierResolver. Trying to
> get a hibernate session for a single tenant fails with an NPE.
>
> Looking into the source code, it seems that JDBCServicesImpl initializes
> the connectionProvider to null in the else block
>
>         private JdbcConnectionAccess buildJdbcConnectionAccess(Map
> configValues) {
>                 final MultiTenancyStrategy multiTenancyStrategy =
> MultiTenancyStrategy.determineMultiTenancyStrategy( configValues );
>
>                 if ( MultiTenancyStrategy.NONE == multiTenancyStrategy ) {
>                         connectionProvider = serviceRegistry.getService(
> ConnectionProvider.class );
>                         return new ConnectionProviderJdbcConnectionAccess(
> connectionProvider );
>                 }
>                 else {
>                         connectionProvider = null;
>                         final MultiTenantConnectionProvider
> multiTenantConnectionProvider =
> serviceRegistry.getService( MultiTenantConnectionProvider.class );
>                         return new
> MultiTenantConnectionProviderJdbcConnectionAccess(
> multiTenantConnectionProvider );
>                 }
>         }
>
> Please find the test case attached to the mail. I have also logged an issue
> <https://hibernate.atlassian.net/browse/HHH-9740>since it's blocking. Is
> there something basic that I am missing.
>
> Thanks,
> Amit.
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>


More information about the hibernate-dev mailing list