JBoss Community

Using JBoss 7 datasource in jBPM5.2

created by Paul Werder in jBPM - View the full discussion

Hi all JBPM users,

I'd need to prepare a demo jbpm 5 application so that I can convince the management staff to use it :-)

I've found a sample demo application on bpmn2's blog which uses jBPM5.2 features to start a process, in the same JVM as the TaskService:

 

try {
DeleteDbFiles.execute("", "JPADroolsFlow", true);
Server h2Server = Server.createTcpServer(new String[0]);
h2Server.start();
} catch (SQLException e) {
throw new RuntimeException("can't start h2 server db",e);
}
 
try {
UserTransaction ut = (UserTransaction) new InitialContext().lookup( "java:comp/UserTransaction" );
      

 

PoolingDataSource ds1 = new PoolingDataSource();

ds1.setClassName("bitronix.tm.resource.jdbc.lrc.LrcXADataSource");
ds1.setUniqueName("jdbc/jbpm-ds");
ds1.setMaxPoolSize(5);
ds1.setAllowLocalTransactions(true);
ds1.getDriverProperties().setProperty("driverClassName", "org.h2.Driver");
ds1.getDriverProperties().setProperty("url", "jdbc:h2:tcp://localhost/JPADroolsFlow");
ds1.getDriverProperties().setProperty("user", "sa");
ds1.getDriverProperties().setProperty("password", "");
   
    ut.begin();
  
    System.setProperty("jbpm.usergroup.callback", "org.jbpm.task.service.DefaultUserGroupCallbackImpl");
   
   EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");
  
    StatefulKnowledgeSession ksession = JbpmAPIUtil.createKnowledgeSession("HelloProcess.bpmn",emf);

That would be perfect, except that it uses a PollingDatasource for the example- I'd rather need to connect to JBoss 7 datasource, or at least use Hibernate configuration file to define the connection properties. Can anybody suggest me how to modify this example ???

Thanks a lot

Paul

Reply to this message by going to Community

Start a new discussion in jBPM at Community