[jboss-user] [JBoss jBPM] - Re: reconfigure hobernate.connection.password for jbpm conne

Johan.Parent do-not-reply at jboss.com
Wed Dec 26 08:08:27 EST 2007


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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115478#4115478

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115478



More information about the jboss-user mailing list