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 call
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.
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.