-
1. Re: The same
nick_nickolov Jul 25, 2005 12:03 PM (in response to kukeltje)I think it would be a better idea to have it directly in Hibernate - a SessionFactory whose openSession() does the thread-local caching. No changes in JBPM would be required then.
Maybe it would be nice to have a
JbpmSessionFactory.openSession(Session)
method, so that you can pass the Hibernate session as a parameter. Do you think I should open a Jira issue? The downside is that one must always be careful to pass a Hibernate session when opening a JBPM session. -
2. Re: The same
tom.baeyens Jul 26, 2005 4:03 AM (in response to kukeltje)a JbpmSessionFactory.openSession(Session) method will be added. see jira.
regards, tom. -
3. Re: The same
nick_nickolov Jul 26, 2005 12:34 PM (in response to kukeltje)Thanks for http://jira.jboss.com/jira/browse/JBPM-297
In case somebody has a similar requirement - until the next release comes out, I've adopted the following solution:JBPM_SESSION_FACTORY = JbpmSessionFactory.buildJbpmSessionFactory(CONFIGURATION);
becomesJBPM_SESSION_FACTORY = new JbpmSessionFactory(CONFIGURATION, null) { public JbpmSession openJbpmSession() { return new JbpmSession(this, HibernateManager.getThreadLocalSession()); } };
HibernateManager is our custom class doing the thread-local session caching, and all stuff related to Hibernate. CONFIGURATION is Hibernate's Configuration. -
4. jBPM and Hibernate thread-local session
wrschneider99 Jun 6, 2006 10:10 AM (in response to kukeltje)I am having the same issue with jBPM 3.1.1. I looked at the JBPM-297
(http://jira.jboss.com/jira/browse/JBPM-297) and wasn't sure if this was implemented yet or how to use it.
The issue is that DbPersistenceService.openSession() calls SessionFactory.openSession() directly. It could instead try SessionFactory.getCurrentSession() first, as that would delegate to Hibernate's standard pluggable mechanism for binding a current threadlocal session. This would also work with Spring transaction management.
-- Bill