Gareth Edwards [
https://community.jboss.org/people/garethed] created the discussion
"Re: Problem with multiple sessions"
To view the discussion, visit:
https://community.jboss.org/message/819640#819640
--------------------------------------------------------------
Hi Maciej,
I will try and get a runnable sample together.
I have simplified my code somewhat and also as a temporary measure, I'm not disposing
of sessions.
More of a problem right now is that sessions don't seem to behave correctly after
loading them manually.
I can see in the database that they are being persisted (The session_info table is being
populated).
After loading and registering listeners, completing a task does not invoke the next task
so the session is pretty useless.
I must have be missing a bit of knowledge on session management.
I'm loading the sessions like this:
// Get cached knowledge base or load based on package name and
version
kbase = packageService.getKnowledgeBase(pws.getPackageRef(),
pws.getPackageVersion());
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
StatefulKnowledgeSession session =
JPAKnowledgeService.loadStatefulKnowledgeSession(pws.getId(), kbase, null, env);
session.getWorkItemManager().registerWorkItemHandler("Human
Task", humanTaskHandler);
session.getWorkItemManager().registerWorkItemHandler("UpdateWorkflowCurrentTask",
new WorkflowCurrentTaskHandler(patientWorkflowSessionService, session.getId(), user));
session.addEventListener(new
WorkflowEventListener(patientWorkflowSessionService, session.getId(), user));
session.fireAllRules();
Gareth.
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/819640#819640]
Start a new discussion in jBPM at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]