[jboss-user] [jBPM] - Using JBoss 7 datasource in jBPM5.2

Paul Werder do-not-reply at jboss.com
Wed Dec 28 13:21:03 EST 2011


Paul Werder [http://community.jboss.org/people/paul1972] created the discussion

"Using JBoss 7 datasource in jBPM5.2"

To view the discussion, visit: http://community.jboss.org/message/643621#643621

--------------------------------------------------------------
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
[http://community.jboss.org/message/643621#643621]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111228/5e5c549a/attachment.html 


More information about the jboss-user mailing list