It appears my only mistake was in closing the jbpmSession and not allowing the
system to take care of it for me.
Calling the SSBs sessionContext.setRollbackOnly() had the expected result of
not persisting the processInstance.
Does anyone know if not closing the jbpmSession will have any adverse affects?
Here's a working copy of my test method:
| public void testHelloWorldProcessDefinition()
| {
| JbpmSession jbpmSession = null;
| InitialContext initialContext = null;
| Connection con = null;
| try
| {
| initialContext = new InitialContext();
| Object jndiObject = initialContext.lookup(JNDINAME);
| JbpmSessionFactory instance = (JbpmSessionFactory)
PortableRemoteObject.narrow(jndiObject, JbpmSessionFactory.class);
| SessionFactory sessionFactory = instance.getSessionFactory();
| Session currentSession = sessionFactory.getCurrentSession();
| jbpmSession = instance.openJbpmSession(currentSession);
|
| ProcessDefinition processDefinition =
jbpmSession.getGraphSession().
findLatestProcessDefinition("hello world");
| ProcessInstance processInstance = new
ProcessInstance(processDefinition);
| Token token = processInstance.getRootToken();
| token.signal();
|
jbpmSession.getGraphSession().saveProcessInstance(processInstance);
| }
| catch (Exception e)
| {
| e.printStackTrace();
| fail("Failure!:\n" + e.getMessage());
| }
| finally
| {
| // Let the system take care of this when the EJB's transaction
| // ends, then the session will be closed.
| // jbpmSession.close();
| //
| initialContext.close();
| }
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3915921#3915921
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3915921
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user