This content has been marked as final.
Show 1 reply
-
1. Re: reconfigure hobernate.connection.password for jbpm conne
johan.parent Dec 26, 2007 8:08 AM (in response to tcroteau)Hi,
I don't know if that's the best way to do this but here is how I did it (just last week in fact).
NOTE: I did this for jbpm3.1 but things may not have changed that much for 3.2.
You need to do 2 things:
1) make your own DbPersistenceServiceFactory
2) patch your jbpm.cfg.xml
Some snippets below (adjust to your package names etc):
In 1 you do the runtime (re)configuration of your credentials. Below I use my own code to get the credentials from somewhere else.public class MyDbPersistenceServiceFactory extends org.jbpm.persistence.db.DbPersistenceServiceFactory { private static final long serialVersionUID = 1L; @Override public synchronized Configuration getConfiguration() { Configuration config = super.getConfiguration(); // config.setProperty("hibernate.connection.username", Credentials.getUsername()); config.setProperty("hibernate.connection.password", Credentials.getPassword()); return config; } }
And now 2 tell jbpm to use your factory by making your jbpm.cfg.xml look like this (more or less):<jbpm-configuration> <jbpm-context> <!--<service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />--> <service name="persistence"> <factory> <bean class="MyDbPersistenceServiceFactory"/> </factory> ....
Hope this helps,
Johan