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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to