0

Is this possible at the current state of the art?

I'm developing a webapp where multi-tenancy is a thing. Since the recent feature request, my customer wants to have an admin panel, where he can trigger the creation of a new tenant.
At the moment & till now, my customer if he wanted a new tenant, wrote me, I made changes to the persistance.xml, standalone.xml and in my abstracted Service class for the PersistenceContext of each EntityManager for each tenant (since I want to be at the secure side). Created the new schema and then I redeployed.

Googling, searching around, reading questions here and on other platforms it seems to be not possible to automate this whole process. Or are there ways?

The problem here I am facing is the editing of a source file and the configuration files. I am aware that I can add new datasources at runtime with the help of the wildfly console but the rest?

Technology in use: JavaEE & Hibernate.

I would appreciate any help here and thanks in forward!

Stefan
  • 67
  • 9
  • 2
    I see two possibilities but only one real solution. In looking at [this post](https://stackoverflow.com/questions/18583881/changing-persistence-unit-dynamically-jpa) and [this](https://stackoverflow.com/questions/11339736/how-to-dynamically-add-datasources-to-jboss-7) (which you indicate) you can dynamically create databases, datasources, etc. But for how long? I'd move everything to a cloud and, on creating a new tenant, create a new server or Docker container, a new DNS entry, and now everything is totally separated. – stdunbar Oct 14 '19 at 17:04
  • This guide gives some info regarding muti tenancy and how you configure persistence https://docs.jboss.org/hibernate/core/4.2/devguide/en-US/html/ch16.html – Will Tatam Oct 15 '19 at 07:57

0 Answers0