I have an application, written in JEE, JPA, I use Payara as the application server.
In my application's persistence.xml I have
<persistence-unit name="XYZ" transaction type="JTA" >
On the payara side, I have JDBC resource called XYZ, with JDBC connection Pool. The database used by the application is dedicated to one customer.
Now I want to deploy this app (unchanged) to other customers (on the same server), each customer needs separate database. In order to achieve that I need to modify persistence unit name for each customer and recompile the app, and of course, define JDBC on the Payara side.
I would like to somehow have this persistence unit name being dynamic, so I don't have to recompile the app for each customer. Is there any simple way to achieve that? In the worst case, I can just modify persistence.xml in the compiled war file, but I hope a more elegant solution exists.
Please advise how to solve that issue.