6 Replies Latest reply on Mar 12, 2009 10:31 AM by François LE QUEMENER

    Persistance and setActorId

    François LE QUEMENER Newbie


      I'm trying to assign one people to one task in my Workflow. I added a custom AssignmentHandler :

      public class CustomAssignmentHandler implements AssignmentHandler {
       private static final long serialVersionUID = 1L;
       public void assign(Assignable assignable, ExecutionContext executionContext) throws Exception {
       Demande demande = (Demande) executionContext.getVariable("demande");

      Here is the interesting part of my process definition :

      <task-node name="validation">
       <task name="validate">
       <assignment class='logica.ws.CustomAssignmentHandler' />
       <transition to="notifier_acceptation" name="validee"></transition>
       <transition to="notifier_refus" name="refusee"></transition>

      When it comes to this task, I get an exception :
      Unknown entity: org.jbpm.taskmgmt.exe.TaskInstance

      Details about the exception here :

      I found nothing when googling...

      What do you think about this ?

        • 1. Re: Persistance and setActorId
          Ronald van Kuijk Master

          your hibernate config is wrong I guess

          • 2. Re: Persistance and setActorId
            François LE QUEMENER Newbie

            Here is my hibernate config file :

            <?xml version='1.0' encoding='utf-8'?>
            <!DOCTYPE hibernate-configuration PUBLIC
            "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
             <property name="connection.url">jdbc:mysql://localhost:3306/econges</property>
             <property name="connection.username">root</property>
             <property name="connection.password">unilog</property>
             <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
             <property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>

            It's a quite simple one...

            • 3. Re: Persistance and setActorId
              François LE QUEMENER Newbie

              In a forum I saw that 3 elements are required for hibernate:
              - a javabean
              - a mapping file
              - a configuration file

              I wrote the last one only, because in jBPM documentation there is no trace of the others. I also saw that jBPM handle everything for the persistance, so that we just have to execute the contextInstance.setVariable().

              Am I right? What did I forget?

              • 4. Re: Persistance and setActorId
                Ronald van Kuijk Master

                The full hibernate configuration indeed consists of multiple files (or at least multiple sections) the mapping file is in the jbpm jar. If the config file you posted is in the wrong place it cannot find the mapping files.

                • 5. Re: Persistance and setActorId
                  François LE QUEMENER Newbie

                  Hum the file is in the right place, I mean it is taken because it connects to the database.

                  I added the mapping files of my classes.

                  But I think the problem is somewhere else. When I'm debugging my action, I see that everything is going wrong since I step into the signal() function :

                  boolean response = false;
                   //required fields, otherwise an exception is thrown...
                   if(demande == null || demande.getDemandeur().getUsername().equals("")) {
                   return false;
                   // Lookup the pojo persistence context-builder that is configured above
                   JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
                   try {
                   ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("demande/processdefinition.xml");
                   //process definition deployment
                   ProcessInstance processInstance = new ProcessInstance(processDefinition);
                   //creates the instance variables
                   processInstance.getContextInstance().setVariable("demande", demande);
                   processInstance.getContextInstance().setVariable("dateEmissionDemande", new Date());
                   // let's go !
                   processInstance.setStart(new Date());
                   //we check if the current active node is the right one : validation
                   Token currentToken = processInstance.getRootToken();
                   } finally {
                   return response;

                  It doesn't go further than processInstance.signal();
                  It comes directly to the finally.

                  • 6. Re: Persistance and setActorId
                    François LE QUEMENER Newbie

                    Sorry my last message doesn't help. I catched the exception and I came back to the first one :
                    couldn't assign id to TaskInstance(validate)

                    The problem is still there...