Skip to content

A simple base to start with hibernate multi tenancy connection providers

Notifications You must be signed in to change notification settings

tuxetuxe/multitenant-connection-provider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

multitenant-connection-provider

Join the chat at https://gitter.im/tuxetuxe/multitenant-connection-provider This is a very simple (and naive ? :) ) way to kickstart the usage of the Hibernate multi tenancy feature.

How to use

  • Add this artifact to your project
  • Extend the class com.twimba.hibernate.AbstractMultiTenantConnectionProvider
  • Implement a org.hibernate.context.spi.CurrentTenantIdentifierResolver
  • Configure hibernate to use multi tenancy:
		params.put(Environment.MULTI_TENANT, MultiTenancyStrategy.DATABASE.name());
		params.put(Environment.MULTI_TENANT_CONNECTION_PROVIDER, <a sub class of AbstractMultiTenantConnectionProvider>);
		params.put(Environment.MULTI_TENANT_IDENTIFIER_RESOLVER, <an implementation of the CurrentTenantIdentifierResolver> );
  • Add tenants configuration.
  • Done! :)

There is a sample implementation in here

References:

License

This is available in the Apache Licence 2.0 http:https://www.tldrlegal.com/license/apache-license-2.0-(apache-2.0)

About

A simple base to start with hibernate multi tenancy connection providers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages