Using GF3.1.x, is there some way to change the files ejb-jar.xml and persistence.xml, and to have a command-line or a programming way to reload these files in the web app?
My Question is why you need to change the persistence.xml files.
Almost all configuration can be configure from container (in this case : glassfish). Use datasource name JNDI to more flexible configuration.
ejb-jar.xml now can be using with 2 method
1. use annotation (programatically)
with this way, you can make some configuration more flexible
2. use xml
Hope this will help you.
I have an webapp shared by many enterprises, where each enterprise has a database. The logical business is the same for all enterprises and in this way it consumes minor memory from the server.
I use ejb-jar to configure JNDI names for databases, like this:
<persistence-context-ref> <description>monteiro</description> <persistence-context-ref-name>persistence/monteiroPU</persistence-context-ref-name> <persistence-unit-name>monteiroPU</persistence-unit-name> <persistence-context-type>Transaction</persistence-context-type> </persistence-context-ref>
Then, I have an installer to put new enterprises, just adding new configurations in ejb-jar and persistence. The problem is that I have to redeploy the webapp after this, and all enterprises become without system.
In your case, my suggesstion is you only need to deploy the new application (war in this case) into separate domains (Glassfish).
Create new domain for each comapny/organization should be ok.
So you can change datasource directly from glassfsh server without have to change the persistence.xml.
This solution to deploy a new app for each company is not possible,
because I have limited memory in the server. I pay for a virtual machine in a ISP with 2 Gb RAM, and with just one Glassfish domain, I get to install until 10 companies. If I will create a Glassfish domain for each one, I don't get to put more than 5 companies. This was the old way I had, bad to scale and save money.
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.