The question is that I want to create a new ProcessInstance inside an outer
ProcessInstance, actually this creation (new) operation is done in the
ActionHandler of the outer ProcessInstance, the key is that the outer one is a
persisted one, but I don't want the inner one to be persisted. So I got the
following exception when I try to close the jbpmContext:
anonymous wrote : org.hibernate.TransientObjectException: object references an
unsaved transient instance - save the t
| ransient instance before flushing: org.jbpm.graph.def.Node
| at
org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:219)
| at org.hibernate.type.EntityType.getIdentifier(EntityType.java:397)
| at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:242)
| at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:597)
| at
org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.
| java:3128)
The code is as below:
The outer one:
| JbpmContext jbpmContext = JbpmConfingurationFactory.jbpmConfiguration
| .createJbpmContext();
| try {
| ...
| ProcessInstance processInstance = new
ProcessInstance(retrievedPd);
| jbpmContext.save(processInstance);
| }
| } finally {
| jbpmContext.close(); //where I get the exception
| }
|
|
One ActionHandler of the outer one which expect to create a new ProcessInstance:
| public void execute(ExecutionContext executionContext) throws Exception {
| // get operation context from workflow
| OperationContext context = (OperationContext) executionContext
| .getContextInstance().getTransientVariable(
| Operation.OPERATION_CONTEXT);
| // create discovery operation
| WorkflowOperation discoveryOperation = new
WorkflowOperation(context);
| // create discovery related workflow
| ProcessDefinition processDefinition =
ProcessDefinition.parseXmlString(definition);
| ProcessInstance processInstance =
| new ProcessInstance(processDefinition);
| ....
|
Can anybody tell me why I got this error, is there any possible workaround?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224264#4224264
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4224264
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user