4 Replies Latest reply on May 20, 2008 2:23 AM by Ronald van Kuijk

    problem persisting jBPM process instance

    Alexandru Enache Newbie

      Hi guys,

      I have a problem persisting a process instance using hibernate. Here is the scenario:
      - I had a project based on jBPM, created on seam 4.0; when persisting a process instance there were no problems
      - in the meantime I changed the project structure to work on seam 4.2; and now I get error when persisting the process instance; below is the error:

      12:35:10,017 ERROR [STDERR] org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping class="ro.fii.projectmanager.model.Flow"/>
       at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1600)
      ...


      and here is the code that is used to persist the process instance:
      JbpmConfiguration jbpmConfig = null;
       JbpmContext jbpmContext = null;
       try {
       jbpmConfig = JbpmConfiguration.getInstance();
       jbpmContext = jbpmConfig.createJbpmContext();
       ProcessDefinition pd = ProcessDefinition.parseXmlString(
       "<process-definition name=\"pd-name\">" +
       " <start-state>" +
       " <transition to='s' />" +
       " </start-state>" +
       " <state name='s'>" +
       " <transition to='end' />" +
       " </state>" +
       " <end-state name='end' />" +
       "</process-definition>");
       ProcessInstance processInstance = new ProcessInstance(pd);
       jbpmContext.save(processInstance);
       }
       catch(Exception e) {
       e.printStackTrace();
       }
       finally {
       if (jbpmContext!=null) {
       jbpmContext.close();
       }
       }


      Even stranger is that when I comment my classes from hibernate.cfg.xml and then try to persist again the process definition I don't get any errors, but the first time it wants to persist the process instance, all the classes from hibernate.cfg.xml are re-mapped and then the process instance is saved.

      I don't know exactly what to ask from you. If anyone has any suggestion they are more than welcomed. Thanks!

      Alex