[jboss-user] [jBPM] - Lazy loading of sub-process

Fabio Spiga do-not-reply at jboss.com
Wed Jul 21 04:05:47 EDT 2010


Fabio Spiga [http://community.jboss.org/people/Spiga] created the discussion

"Lazy loading of sub-process"

To view the discussion, visit: http://community.jboss.org/message/553601#553601

--------------------------------------------------------------
Hi all,
I have a problem in getting a subprocess reference from the main process instance.
My code is the following:

ProcessInstance processInstance = executionService.startProcessInstanceByKey("RPG");
ExecutionImpl ex_pi = ((ExecutionImpl) processInstance).findActiveExecutionIn("integr_doc");
ProcessInstance sub_pi = ex_pi.getSubProcessInstance();    
assertNotNull(sub_pi);

where "integr_doc" is the name of a subprocess

The call to "getSubProcessInstance()" is succesful, but the object "sub_pi" throws an Exception if I try to read any property of it because it was lazy initialized and the session has been closed.

I get the following exception:

org.hibernate.LazyInitializationException <init>
GRAVE: could not initialize proxy - no Session
org.hibernate.LazyInitializationException: could not initialize proxy - no Session

In order to resolve this problem, I have found only one solution: modifying the "jbpm.execution.hbm.xml" in "jbpm.jar" by adding the attribute "lazy=false" to the foreign-key "FK_EXEC_SUBPI".
This is a very awful solution because I had to modify the original library!
If I put a copy of "jbpm.execution.hbm.xml" in the classpath (in order to not modify the original library), JBoss AS try to map jBPM entity beans before the related classes are loaded, so it fails to start.

Is there a way to get a subprocess instance more gracefully?

Thank you in advance and sorry for my long thread...

Fabio

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

Reply to this message by going to Community
[http://community.jboss.org/message/553601#553601]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100721/c10d6beb/attachment.html 


More information about the jboss-user mailing list