[jboss-user] [jBPM] New message: "Persisting Hibernate entities as process variables"

Niklas Gustavsson do-not-reply at jboss.com
Mon Feb 1 07:06:03 EST 2010


User development,

A new message was posted in the thread "Persisting Hibernate entities as process variables":

http://community.jboss.org/message/523327#523327

Author  : Niklas Gustavsson
Profile : http://community.jboss.org/people/protocol7

Message:
--------------------------------------------------------------
Hi
 
As part of a jBPM4 prototype I'm working on, I would like to add instances of a custom class as process variables. I've created a Hibernate mapping definition and also confirmed that it works as expected when persisting this using the Hibernate API directly. However, when adding my instance as a variable, the following exception is thrown (tested with 4.2 and 4.3):
Exception in thread "main" org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: se.vgregion.rosproto.model.Issue
 
A reference to the Hibernate mapping has been added to the jBPM Hibernate configuration file (I use the same file when using Hibernate directly).
 
Do I need to persist the object myself before adding it as a variable or I'm I missing something obivous here? (I'm guessing the latter :-)
 
Here's the code I'm using, based on jbarrez Hello world example.
 
          ProcessEngine processEngine = new Configuration().setResource("my.jbpm.cfg.xml").buildProcessEngine();          RepositoryService repositoryService = processEngine.getRepositoryService();          ExecutionService executionService = processEngine.getExecutionService();                    repositoryService.createDeployment().addResourceFromClasspath("hello_world.jpdl.xml").deploy();                    Issue issue = new Issue();          issue.setRequestor("req");          issue.setResponder("resp");                    ProcessInstance instance = executionService.startProcessInstanceByKey("helloWorld");          executionService.setVariable(instance.getId(), "issue", issue);
 

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/523327#523327




More information about the jboss-user mailing list