1 Reply Latest reply on Feb 26, 2006 4:31 PM by Jos Dirksen

    ObjectNotFoundException while deleting instance

    Jos Dirksen Newbie

      I want to be able to delete processes that have finished or are in an unrecoverable state. I thought this would just be easy just by using:


      JbpmContext ctx = JbpmConfiguration.getInstance().createJbpmContext();
       try {
       ProcessInstance inst = ctx.loadProcessInstance(id);
       ctx.getGraphSession().deleteProcessInstance(inst);
       }
       finally {
       ctx.close();
       }


      But this doesn't seem to work. When I do this it results in this:

      org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [org.jbpm.graph.exe.ProcessInstance#2708]
       at org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27)
       at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:65)
       at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98)
       at org.hibernate.impl.SessionImpl.bestGuessEntityName(SessionImpl.java:1701)
       at org.hibernate.impl.AbstractQueryImpl.setEntity(AbstractQueryImpl.java:564)
       at org.jbpm.db.GraphSession.deleteProcessInstance(GraphSession.java:329)


      Any idea what I might be doing wrong? It's strange that I can load the instance, but I can't delete it.

      Hope someone can help me with this.