0 Replies Latest reply on Feb 7, 2007 9:07 AM by Daniel Hirscher

    custom node-type derived from superstate produces hibernate

    Daniel Hirscher Newbie

      Hello,

      I'm trying to create a custom node type called my-step which should be a container like super-state.

      I'm using jbpm-3.1.4 and set up the junit test case scenario from the documentation, chapter "3.2. Database example". I changed the method "deployProcessDefinition": i switched "JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();" to be the first statement in this method, so that "...ProcessDefinition.parseXmlString..." uses the config defined in the unit test and not some default settings. Then I changed the config to point to my node-types.xml where I added this line:

      <node-type element="my-step" class="test.Step" />

      The class looks like this:
      package test;
      
      import org.jbpm.graph.def.SuperState;
      
      public class Step extends SuperState {
      
       private static final long serialVersionUID = 1L;
      
       public Step() {
       System.err.println("Hello there.");
       }
      
       public Step(String name) {
       super(name);
       System.err.println("Hello: " + name);
       }
      }
      


      I changed the process definition and wrapped the state into super-state.
      When I run it, everything works as expected.
      When I change super-state into my-state, I get the following hibernate exception (shortened) after my output "Hello there.":
      org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session
      ...
      Caused by: org.hibernate.HibernateException: instance not of expected entity type: test.Step is not a: org.jbpm.graph.def.Node
      ...
      


      I don't understand this. Step extends SuperState and SuperState extends Node, so Step is a Node - isn't it?
      Do I need a hibernate mapping for my class? What should it look like?
      Maybe it is not supported to extend SuperState? I don't like to copy the SuperState class. In fact it is not possible because the class uses the superstate field from Node which is not accessible from a copy...

      What can I do?
      Is it a bug?

      --
      Regards,
      Daniel