Posts

Multitenancy in existing java application

Hibernate provides out of the box support for multi-tenancy and that is key advantage for converting existing hibernate/JPA based application to multi-tenant. For data access layer you just need to change few hibernate settings and Boom…. All your data access layer is all of a sudden supports multi tenancy. So let’s take a look at all possible change you might need when you are converting your existing single tenant application to multi-tenant. Assumptions: a)        I am using Hibernate in data access layer. b)       I am using ThreadLocal variable to store and retrieve tenant context in all layers of application. Steps: 1)       I will start with Hibernate settings that we need to change. You might have already figured this out from all different blogs available over internet. If so, you can skip this section. Solution:  Update your persistence.xml file with following elements. <properties>           <property name="hibernate.cache.use_secon
Recent posts