-
1. Re: Find a process via variable associated with it - unique
dslevine Jan 14, 2007 4:13 PM (in response to aakil786)I am trying to figure out the best way to do this as well. Please share any ideas you come up with. The way I have come up with for now is to define a link from my object to the variableInstance object in Hibernate. (Assuming you are saving your objects as HiberateLongVariable type objects.)
<class name="MyObject" table="MY_TABLE"> <set name="variableInstances"> <key column="LONGVALUE_" /> <one-to-many class="org.jbpm.context.exe.variableinstance.HibernateLongInstance" /> </set> </class>
Then you can call myObject.getVariableInstances to return a Set. On each variable in that list you can then call hibernateLongInstance.getProcessInstance();
The ProcessInstance works fine... except...
I am having a separate problem where when I access the ProcessInstance this way, and I then callprocessInstance.getContextInstance().createVariable("anotherVariable", anotherVariable)
the variables dont get set in the DB at all. Hmmmmmm. Any thoughts?
Again, I dont think this is the "best" way to access the variables from the object, so please share back any other thoughts.
dan -
2. Re: Find a process via variable associated with it - unique
aakil786 Jan 15, 2007 3:19 AM (in response to aakil786)I see this topic was previously discussed not sure why I did not find it before ;-) anyway here is the link
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=84817 -
3. Re: Find a process via variable associated with it - unique
aakil786 Jan 15, 2007 8:22 AM (in response to aakil786)I used the code in searchInstances() in MonitoringBean provided with the 3.1.2 webapp and bastardized it for my requirements. I also added an index for the name_ and longvalue_ column, which is what I am using in my where clause.
My reason for not takng a similar approach to dslevine is that I need JBPM to be as losely coupled from the client application as possible. All access to jBPM is via a Stateless Session Bean without the frontend application knowing to much about the internal workings of the JBPM.