[hibernate-dev] multi-tenancy and ConnectionProvider

Adam Warski adam at warski.org
Wed Mar 23 16:25:00 EDT 2011


I think for a user the best option (easiest to understand) would be 1).

3) is too magical. 2) is putting everything in one sack.

Adam

On Mar 22, 2011, at 10:21 PM, Steve Ebersole wrote:

> reference http://opensource.atlassian.com/projects/hibernate/browse/HHH-5697
> 
> For multi-tenancy implemented by sepaerate schema we need the ability to tell 
> the ConnectionProvider about the tenant for the given getConnection() request.  
> I really see 3 approaches to this:
> 
> 1) Have 2 hierarchies here.  The current ConnectionProvider contract remains 
> the same.  Add a new MultiTenantConnectionProvider with methods accounting for 
> tenant
> 2) Just alter the ConnectionProvider contract to pass information in.  If we 
> go this route I prefer the "parameter object" pattern where we pass in 
> ConnectionOptions interface (see issue).
> 3) Use contextual lookup.  ConnentionProviders interested in (or capable of 
> understanding) mulit-tenancy would perform some kind of "contextual" 
> (ThreadLocal, etc) lookup for the needed information.
> 
> Thoughts?  Discussions?
> 
> ---
> Steve Ebersole <steve at hibernate.org>
> http://hibernate.org
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev

-- 
Adam Warski
http://www.warski.org
http://www.softwaremill.eu








More information about the hibernate-dev mailing list