Search code examples
jakarta-eejbossglassfishmulti-tenantjaas

Glassfish/JBoss different DB for the same application, depending on who is logged in?


I'm developing an Java EE 6 application that will run as a SaaS but each client will have a completely isolated database. Also, the security will be managed using the server (JBoss or Glassfish) JAAS. What I need is to get the correct database, based on the subdomain (client1.domain.com, client2.domain.com).

What is the best way to do that?

Thanks!


Solution

  • In that case applications isolation needed in order to resolve JPA cache and EJB issues. There are many ways to allow one application to live with many DBs, but is it worth dealing with isolation on application level? You can use different AS domains or different context paths for each application dealing with one client.