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#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...