I have to implement Multi-Tenant Web application having following requirements
Single Table Multi-Tenancy : All tenant's data for particular entity will be stored in a single table with TENANT_DISCRIMINATOR (TENANT_ID) as a column in each table.
Some tables for example Master Countries, Masters... , I want it to be common for all tenants i.e In those table, there will not be a column like TENANT_DISCRIMINATOR (TENANT_ID) and still I want to access it seamlessly.
On request or maintenance reason, I want to move data of Tenant which is already a part of Single Table Multi-Tenancy to a separate database schema and a vice-a-versa by some admin configuration and my web app, on next request should be able to communicate with that updated schema/datasource.
Right now for single table for all tenants. I have used
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
and plugged a
org.springframework.jdbc.datasource.DriverManagerDataSource
into that. I want to have flexibility over here which can read some configuration and help me to decide the same table/data-source or some different data-source.
First two points, I am able to fulfill with EclipseLink framework.
My questions are
Is it possible to implement point 3 using EclipseLink?
Can hibernate 3+ or 4+ help me to implement these ?
Any help will be a appreciated.