[jboss-user] [jBPM] - jBPM 5.3 and database access

jena74 do-not-reply at jboss.com
Mon Jun 4 11:30:53 EDT 2012


jena74 [https://community.jboss.org/people/jena74] created the discussion

"jBPM 5.3 and database access"

To view the discussion, visit: https://community.jboss.org/message/739727#739727

--------------------------------------------------------------
Hello,

I have created a small process which has one script task. In this task, I call one method of a personal Java class. Then this method updates an existing line in an Oracle database and commit.
As my table is located in the same schema of the one owning the jBPM persistence tables, in my Java class I use the PoolingDataSource returned by JBPMHelper.setupDataSource().
But, when I run my process, I have an error saying: 
+java.sql.SQLException: cannot commit a resource enlisted in a global transaction+

As I configured my jBPM engine to persist the data, I imagine that there is a transaction while my script task executes. That's why I can not to the commit.
So I am wondering how I should in fact design such a behaviour:

1) Should I first put my own tables into an Oracle schema different that the one used by jBPM to persist? I think yes.
2) According to what I read in the documentation, I should also use a Service task instead of a script task as a database access can be long, with timeouts...
3) Can I reuse in my own Java code the PoolingDataSource returned by JBPMHelper.setupDataSource()? I assume that I should not, and particularly if I put my tables in another schema.
4) If I write a service task to write in database, how should I design this task? I mean, should I reuse hibernate and the persistence.xml file for that? Can I do basic JDBC accesses? What are the best practices usually applied for such situation?
5) It is not clear at all in my mind when a transaction starts and stops in a jBPM process. What are the safe points? Could you basically explain?

Thanks a lot.

Jena
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/739727#739727]

Start a new discussion in jBPM at Community
[https://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/20120604/7395fa1d/attachment.html 


More information about the jboss-user mailing list