JBoss Community

Re: Process persistense - change WHEN it should happen!

created by nt2005 in jBPM - View the full discussion

Hey guys,

 

There is a simple question, if I do something wrong.

 

I have many own workitems they look like this:

 

public class SimpleWorkItem implements WorkItemHandler {

    public static final String NAME = "simple";

    public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
        
        System.out.println("WorkItemHandler ->" + workItem.getId() + " - " + workItem.getName());

        // do anything else

        manager.completeWorkItem(workItem.getId(), results);
    }

    public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
    }
}

 

After start a process and look in the sql command I noticed, that each workitems get a sql-query like:

 Hibernate: 
     insert 
     into
         WorkItemInfo
         (creationDate, name, processInstanceId, state, OPTLOCK, workItemByteArray, workItemId) 
     values
         (?, ?, ?, ?, ?, ?, ?)

 Hibernate: 
     update
         WorkItemInfo 
     set
         creationDate=?,
         name=?,
        processInstanceId=?,
         state=?,
         OPTLOCK=?,
         workItemByteArray=? 
     where
         workItemId=? 
         and OPTLOCK=?

 Hibernate: 
    delete 
    from
        WorkItemInfo 
     where
         workItemId=? 
         and OPTLOCK=?

 

Is this really necessary - or do I use WorkItems wrong? There was no break between execution, just ksession.startProcess(....)

Reply to this message by going to Community

Start a new discussion in jBPM at Community