2 Replies Latest reply on Apr 27, 2006 7:06 AM by Jim Rigsbee

    Jbpm Core - do you consider this a bug?

    Jim Rigsbee Newbie

      Greetings,

      Consider this situation:

       try {
       ProcessInstance pi =
       context.getGraphSession().loadProcessInstance(4L);
       if (pi != null) {
       // you got it, do whatever
       }
       } catch (Exception e) {
       // do whatever you need to, the process instance was not found
       }
      


      process instance #4 does not exist in the database. To me the result is not what I expect. I get a non-null proxy reference to a ProcessInstance object. There is no exception thrown as my code was ready to handle.

      The only way I can find out if the instance is real is to do a pi.getId() within a try/catch.

      This is due to the way that loadProcessInstance( ) uses hibernate. This load uses session.load( ) to get the instance. The hibernate javadocs indicate that load does not indicate whether an item exists or not and that you should use get( ) if you need to know of existence.

      Shouldn't we be using get on these key database queries?

      Do you consider this a bug? A good enhancement?

      Regards, Jim