This content has been marked as final.
Show 5 replies
-
1. Re: Getting JBPM to use the seam managed persistence context
pmuir Nov 15, 2007 5:17 PM (in response to jcruise)IIRC jbpm still uses hibernate directly rather than using JPA. With this in mind I think you can't use persistence.xml, but maybe you can use a Seam managed session. Perhaps ask on the jbpm forum as I don't know if this is possible.
-
2. Re: Getting JBPM to use the seam managed persistence context
jcruise Nov 16, 2007 5:24 AM (in response to jcruise)Ok. Do you have any interest in a patch to allow us to do something like this in components.xml:
<bpm:jbpm name="config1" jbpm-configuration-name="jbpm-1.cfg.xml" /> <bpm:jbpm name="config2" jbpm-configuration-name="jbpm-2.cfg.xml"/> <bpm:managed-jbpm-context name="jbpmContext" auto-create="true" jbpm-session-factory="#{jbpmConfiguration}" />
where jbpmConfiguration would a reference to either config1 or config2
Note that the current managed JbpmContext has a hard dependency on the default jbpm implementation because of code like this:jbpmContext = Jbpm.instance().getJbpmConfiguration().createJbpmContext();
You can't just set the session context manually after getting the ManagedJbpmContext, nor can you replace the default implementation of ManagedJbpmContext without patching Seam because of code like this:ProcessInstance process = ManagedJbpmContext.instance().newProcessInstanceForUpdate(processDefinitionName);
in the classes in org.jboss.seam.bpm.
Thoughts appreciated.
Cheers
J -
3. Re: Getting JBPM to use the seam managed persistence context
pmuir Nov 24, 2007 4:52 PM (in response to jcruise)"jcruise" wrote:
Note that the current managed JbpmContext has a hard dependency on the default jbpm implementation because of code like this:jbpmContext = Jbpm.instance().getJbpmConfiguration().createJbpmContext();
I don't understand this statement - yes, it requires that Jbpm.instance().getJbpmConfiguration() returns an instance of org.jbpm.JbpmConfiguration - but that is the public API of the jbpm component (and I don't see a way around that), but there is no hard dependency to Jbpm there at all.You can't just set the session context manually after getting the ManagedJbpmContext, nor can you replace the default implementation of ManagedJbpmContext without patching Seam because of code like this:
ProcessInstance process = ManagedJbpmContext.instance().newProcessInstanceForUpdate(processDefinitionName);
Again, why not?
(I think you haven't fully understand the precedence and component overriding rules of Seam). -
4. Re: Getting JBPM to use the seam managed persistence context
jcruise Nov 29, 2007 5:11 AM (in response to jcruise)OK. I assumed, perhaps erroneously, that the component overriding rules would only work if you looked up the component by name. I believed that this code would always return an instance of ManagedJbpmContext.
public static JbpmContext instance() { if ( !Contexts.isEventContextActive() ) { throw new IllegalStateException("no active event context"); } return (JbpmContext) Component.getInstance(ManagedJbpmContext.class, ScopeType.EVENT); }
Are you saying that I can install my own replacement for ManagedJbpmContext and that the ManagedJBpmContext.instance() call shown above would return my component?
Cheers
J -
5. Re: Getting JBPM to use the seam managed persistence context
jcruise Nov 29, 2007 9:42 AM (in response to jcruise)Ok.
public static Object getInstance(Class<?> clazz, ScopeType scope, boolean create) { return getInstance( getComponentName(clazz), scope, create ); }
I can see that the static instance() call does ultimately result in retrieving the component by name.
Consider me educated now :)
Cheers
J