[JBoss jBPM] - Re: SLSB + JBPM Rollback
by AmiraTalbi
Hi kukeltje;
Thanks for your reply.
I'm using JBPM3.2.2 and I checked out project from SVN to change the hbm files us mentionned.
My transaction schema is :
- I'm receinving messages from asynchronous systems via an MDB, the MDB dispatches the message to a session Bean that fire the process instance to move to next state, from that, the process is entering a fork node with 2 transistions. I throwed an exception in one of that transitions. So when the exception is thrown, exception handler is invoqued + a rollback from the lower level of the transaction.
- Process action handlers use a SLSB to do the business logic and this SLSB is injecting other ones
Hope that I was clear in my description
Thkx in advance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4197055#4197055
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4197055
15 years, 6 months
[JBoss jBPM] - Re: Problem with a decision node in a fork, join construct.
by kukeltje
H2 is cooooooooooool..... it has an oracle and postgress compatible mode.... If you use it's own H2 driver, but point to a Oracle dialect and state in the connect string the mode is oracle, like:
| <!-- hibernate dialect -->
|
| <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
|
|
| <!-- JDBC connection properties (begin) -->
| <property name="hibernate.connection.driver_class">org.h2.Driver</property>
| <property name="hibernate.connection.url">jdbc:h2:~/jbpm;MVCC=TRUE;MODE=Oracle
| </property>
| <property name="hibernate.connection.username">sa</property>
| <property name="hibernate.connection.password"></property>
| <!-- JDBC connection properties (end) -->
|
|
I get a StaleObjectException..... now is that cool or what.... and even better... it has PostgreSQL, mysql, mssql, derby, mysql, hsqldb compatible modes. PostgreSQL also gives me a SOE!!! wow....
It does not support the dialects fully, but a real large part.... nice....
No more HSQLDB for me...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4197001#4197001
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4197001
15 years, 6 months
[JBoss jBPM] - Re: Problem with a decision node in a fork, join construct.
by kukeltje
Martin... I found a similarity.... Oracle and Postgress use sequences, mysql, h2 and hsqldb use auto-increment like id's. I've seen that postgress can also support auto-increment if the int8 is changed to 'serial', see http://www.postgresql.org/docs/8.1/interactive/datatype.html#DATATYPE-SERIAL
hibernate does seem to support this: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1675
You have to change 'native' to 'identity' then in the Node.hbm.xml besides changing the sql. Maybe it is worth a try (besides trying with the flush added)
I have a unit test
| package org.jbpm.graph.node;
|
| import org.hibernate.LockMode;
| import org.jbpm.db.AbstractDbTestCase;
| import org.jbpm.graph.def.ProcessDefinition;
| import org.jbpm.graph.exe.ExecutionContext;
| import org.jbpm.graph.exe.ProcessInstance;
|
| public class StaleObjectExceptionJoinTest extends AbstractDbTestCase {
|
| public void testDirectTransitionsToJoin() {
| ProcessDefinition processDefinition = ProcessDefinition
| .parseXmlString("<process-definition name='"
| + getName()
| + "'>"
| + " <start-state name='start'>"
| + " <transition name='fromStartToFork' to='fork'/>"
| + " </start-state>"
| + " <fork name='fork'>" // the default
| //+ " <fork name='fork' async='true'>" // Async sometimes solves things that should not be a problem
| + " <transition name='fromForkToDecide1' to='decide1'/>"
| + " <transition name='fromForkToDecide2' to='decide2'/>"
| + " <transition name='fromForkToState' to='state'/>"
| + " </fork>"
| + " <decision name='decide1'>"
| + " <handler class='org.jbpm.graph.node.StaleObjectExceptionJoinTest$Decision1'/>"
| + " <transition name='fromDecide1ToJoin' to='join'/>"
| + " </decision>"
| + " <decision name='decide2'>"
| + " <handler class='org.jbpm.graph.node.StaleObjectExceptionJoinTest$Decision2'/>"
| + " <transition name='fromDecide2ToJoin' to='join'/>"
| + " </decision>"
| + " <state name='state'>"
| + " <transition name='fromStateToJoin' to='join'/>"
| + " </state>"
| + " <join name='join'>" /* the default */
| //+ " <join name='join' lock='"+ LockMode.UPGRADE.toString() + "'>" /* same as 'pessimistic' */
| //+ " <join name='join' lock='"+ LockMode.UPGRADE_NOWAIT.toString() + "'>" /* something for Oracle */
| //+ " <join name='join' lock='"+ LockMode.READ.toString() + "'>" /*... */
| //+ " <join name='join' lock='"+ LockMode.WRITE.toString() + "'>" /*... */
| + " <transition name='fromJoinToEnd' to='end'/>"
| + " </join>"
| + " <end name='end'/>"
| + "</process-definition>");
|
| jbpmContext.deployProcessDefinition(processDefinition);
| long processDefinitionId = processDefinition.getId();
| newTransaction();
|
| try {
| processDefinition = graphSession
| .findLatestProcessDefinition(getName());
| ProcessInstance pi = jbpmContext.newProcessInstance(getName());
| assertEquals("start", pi.getRootToken().getNode().getName());
| pi.signal();
| assertEquals("fork", pi.getRootToken().getNode().getName());
| assertEquals("join", pi.findToken("/fromForkToDecide1").getNode().getName());
| assertEquals("join", pi.findToken("/fromForkToDecide2").getNode().getName());
| assertEquals("state", pi.findToken("/fromForkToState").getNode().getName());
|
| } finally {
| newTransaction();
| graphSession.deleteProcessDefinition(processDefinitionId);
| }
|
| }
|
| public static class Decision1 implements DecisionHandler {
| private static final long serialVersionUID = 1L;
|
| public String decide(ExecutionContext executionContext) {
| return "fromDecide1ToJoin";
| }
| }
|
| public static class Decision2 implements DecisionHandler {
| private static final long serialVersionUID = 1L;
|
| public String decide(ExecutionContext executionContext) {
| return "fromDecide2ToJoin";
| }
| }
|
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4196988#4196988
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4196988
15 years, 6 months