[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5697?page=c...
]
Steve Ebersole commented on HHH-5697:
-------------------------------------
We need a way to allow developers to tell Hibernate the {{tenant_id}} column without
having a corresponding entity attribute. So most likely a piece of entity-level metadata.
Perhaps:
{code}
@Entity
@TenantDiscriminator(column="tenant_id")
public class SomeEntity {...}
{code}
In the "separate schema" scenario, all mapped entities must be available via the
tenant Connection. In the "discriminator" scenario however it is not
necessarily a requirement for all the entities to be discriminated by tenant (reference
data, countries, etc). The reason I mention that is because the above syntax gives the
impression that multi-tenancy can be decided entity-by-entity which is simply not a truth
across both strategies.
Support for multi-tenancy
-------------------------
Key: HHH-5697
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5697
Project: Hibernate Core
Issue Type: New Feature
Components: core
Reporter: Steve Ebersole
Fix For: 4.0.0.Alpha2
Thinking that all that is really needed here is the ability to tell the {{Session}}
(session creation options?) which tenant it is for. Then, this could be
"handled" or "applied" by the {{ConnectionProvider}}
For example:
{code}
Session s = ...;
s.setTenant( "customer1" );
{code}
or somehow passed along to the {{openSession}} call.
Then this could be passed to the {{ConnectionProvider}}, or maybe the {{Session}} itself
is passed along:
{code}
public interface ConnectionProvider {
...
public Connection getConnection(String tenant);
}
{code}
or
{code}
public interface ConnectionProvider {
...
public Connection getConnection(Session session);
}
{code}
or even another:
{code}
public interface ConnectionProvider {
...
public static interface ConnectionOptions {
public String getTenant();
...
}
public Connection getConnection(ConnectionOptions options);
}
{code}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira