Issue Type: Bug Bug
Affects Versions: 4.1.4
Assignee: Unassigned
Attachments: DatabaseBasedMultiTenancyTest.java
Components: core
Created: 15/Jun/12 9:48 AM
Description:

If you have provided your own MultiTenantConnectionProvider using the database based Multi-tenant strategy this provider is not used by JdbcServicesImpl and the connection provider is not initialized. Please see attached unit test.

This problem prevents you from providing your own MultiTenantConnectionProvider.

/**

  • Sequence of events
  • 1.
  • buildJdbcConnectionAccess - JdbcServicesImpl
  • if ( MultiTenancyStrategy.NONE == multiTenancyStrategy ) { connectionProvider = serviceRegistry.getService( ConnectionProvider.class ); return new ConnectionProviderJdbcConnectionAccess( connectionProvider ); }
    else { //HITS THIS BLOCK IN JdbcServicesImpl intializing service, connectionProvder is set to null connectionProvider = null; final MultiTenantConnectionProvider multiTenantConnectionProvider = serviceRegistry.getService( MultiTenantConnectionProvider.class ); return new MultiTenantConnectionProviderJdbcConnectionAccess( multiTenantConnectionProvider ); }

2. SessionFactory Impl validates schema
if ( settings.isAutoValidateSchema() ) { new SchemaValidator( serviceRegistry, cfg ).validate(); }

3. SuppliedConnectionProviderConnectionHelper constructor passed connection provider from JdbcServicesImpl which is null

4. SuppliedConnectionProviderConnectionHelper prepare calls
public void prepare(boolean needsAutoCommit) throws SQLException { connection = provider.getConnection(); THROWS NPE */ }

Environment: 4.1.4
Project: Hibernate ORM
Priority: Major Major
Reporter: Christopher Williams
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira