It's easy, simply edit hibernate.cfg.xml file for another datasources which you have.
I've made some basic tests with two ears containing :
Let's say ears are called app1.ear and app2.ear. They both contain the same structure and files and hibernate.cfg.xml files use distinct JNDI datasources defined in jbpm-ds.xml.
What i see when starting JBoss and hot-deploying applications one by one is the following :
- I deploy app1.ear and application starts correctly and JBPM objects are mapped through Hibernate using config information for datasource 1
- I deploy app2.ear and application starts correctly but JBPM objects are not mapped a second time using config information for datasource 2. This results in app2.ear using processes and definition from JBPM database 1...
That's why i was asking myself if such a scenario is possible with JBPM.
Any idea ?
You should use different war names to avoid conflicts.
I haven't tried what you are trying to achieve, but it sounds like you run into this issue of both applications using the same jars/resources because of the flat class loading model JBoss uses.
See http://wiki.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration for more information, and try it again after inserting a jboss-app.xml in your ear files with class loader isolation settings as outlined in the wiki. And also set a different context to the jBPM web applications.
Martin is right, and different war names are not needed if they are in different ear files
Ok that did the trick :
I've set attribute "Isolated" to true in ear-deployer.xml.
The remaining question is : do I need to set "CallByValue" attribute to true ?
If i understand correctly this setting, it is needed for remote calls.
If my ears are "standalone" apps that embed everything needed and don't interact with any other Java app, i don't need it, right ?
Because it seems that this setting has a non-neglectable impact on performance.
Thanks for your answers,