I am using Hibernate 4.2 & EJB 3.0. I following the strategy outlined in https://docs.jboss.org/hibernate/core/4.2/devguide/en-US/html/ch16.html
Separate Schema approach.
I have added the following in my persistance.xml file
Code:
<property name="hibernate.multi_tenant_connection_provider" value="com.lombardrisk.util.multitenancy.MultiTenantProvider" />
<property name="hibernate.tenant_identifier_resolver"
value="com.lombardrisk.util.multitenancy.SchemaResolver" />
<property name="hibernate.multiTenancy" value="SCHEMA" />
But for some reason it appears those 3 properties are completely ignored. I have tired commenting the properties - hibernate.multi_tenant_connection_provider & hibernate.tenant_identifier_resolver
(I was hoping to see an exception - since as per the documentation - It is an error to attempt to open a session without a tenant identifier using this strategy. Additionally, a org.hibernate.service.jdbc.connections.spi.MultiTenantConnectionProvider must be specified.)
http://stackoverflow.com/questions/19348477/multitenancy-with-hibernate-4-0-with-separate-schema-approach
The above link also points to the same problem - but does not explain how the problem was solved. Would appreciate if some one can point me to the right direction.
Note: I have also tried removing the classes MultiTenantProvider & SchemaResolver from my ear file and deployed the App in Jboss - but still there is no exception and the app always uses the default schema - so it looks like - those 3 properties are completely ignored in my persistance.xml
regards
D