I am running a java app (java 1.7) with hibernate 4.2.0 and I need to implement a schema based multi tenancy setup. I used this exampleto do that. my problem is that I was unable to figure out how to create the connection providers. the example uses:
acmeProvider = ConnectionProviderBuilder.buildConnectionProvider( "acme" ); jbossProvider = ConnectionProviderBuilder.buildConnectionProvider( "jboss" );
but ConnectionProviderBuilder is for testing use.
I tried to use the following:
C3P0ConnectionProvider connectionProvider = new C3P0ConnectionProvider() { public boolean supportsAggressiveRelease() { return allowAggressiveRelease; } }; connectionProvider.configure(props);
the problem here was that the C3P0ConnectionProvider has a null serviceRegistry which crush the with NPE.
does anyone have an idea on how to create ConnectionProvider for each tenant?
Thanks,
Ronen