My persistence.xml is currently present in the application war(in META-INF folder.). However, for the application to be run across multiple DBs the persistence needs to be changed again and again. I want to avoid it. But, I am not able to understand how will i configure the properties(like dialect) in the persistence.xml from, say, a property file which i would change based on my DB, hence not compelling me to update and redeploy my war.
My problem can also be resolved if i can configure the dialect in the datasource in standalone.xml where i have mentioned other DB details. I am not being able to make out what the property would be. Though i would prefer a solution for the first one.
PS: I am rookie in Web App development. Questions might annoy you. :D
I use a method that works well for hibernate.
1) put the hibernate configuration properties in a xml file (call it hibernate.cfg.xml but it's not mandatory)
this is an example:
you can put there only hibernate properties that do not start with
hibernate.ejb
2) Create a jboss module. It's very simple. Suppose you want to call the module com.myorganization.config than create a directory structure in the
modules
folder of you server installation: /com/myorganization/config/main. In the main folder put the hibernate.cfg.xml file and the followingmodule.xml
file:3) In your persistence.xml adding the following property:
4) Finally, in the META-INF/MANIFEST.MF file add the following line:
If you like maven use the maven-war-plugin in order to change the MANIFEST.MF:
That's all.