Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SaaS - Multi tenant Separate database model Implementation in Java

I am architecting a software project and I want to achieve a SAAS (Software As a service) model. I want to design a web application compatible to multi tenancy with separate database per tenant.

How can i design Multi tenant UI in Java environment(UI should be tenant configurable in nature)?

How can I design data access layer for separate database per tenant(Single application instance for multiple tenant database)?

And also suggest me to choose technology stack in Java environment.

Thanks in advance.

like image 259
Mukthi Avatar asked Mar 23 '23 04:03

Mukthi


1 Answers

This post has details on the database architecture for multitenancy.

How can i design Multi tenant UI in Java ...

This depends on the requirement. If the tenants views are completely different, different pages, layout, flow etc, then you can have a page per tenant. Usually the pages are similar except that the data view is different. In that case, same ui can be used across tenants and the view driven by tenant configuration. The view should be metadata driven. The view can be configurable by having a configuration mapping/db where each tenants configuration is stored. The tenant can choose what can be displayed during configuration.

How can I design data access layer for separate database per tenant....

This is controlled by the data source. You need to essentially differentiate the data connections and connection pools based on the tenant identifier. This can be achieved using a custom data access object where you instantiate the data source for different tenants. Hibernate provides support for multitenancy http://docs.jboss.org/hibernate/orm/4.1/devguide/en-US/html/ch16.html

suggest me to choose technology stack in

This is very broad question. I have some suggestions, take a look at this

like image 140
techuser soma Avatar answered Apr 26 '23 17:04

techuser soma