1 Reply Latest reply on Sep 25, 2007 11:06 AM by Ross McDonald

    subclassing TaskInstance and setting up hibernate mapping fo

    Ross McDonald Novice

      Hi guys,

      as per the CustomTaskInstance example, I am subclassing TaskInstance, and adding a couple of simple properties, I have created a new class subclassing TaskInstance, and the hibernate mapping field to go with it...

      What I am unsure about, is how the hibernate mapping file relates to my MySQL database, do I need to modify the original TaskInstance table in MySQL to reflect the changes (fields added) in my new extended class, or do I create a new table JBPM_NEWTASKINSTANCE that is a duplicate of JBPM_TASKINSTANCE table but with the new fields added.

      My hibernate mapping file is listed below...

      <?xml version="1.0"?>
      <!DOCTYPE hibernate-mapping PUBLIC
       "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
      <hibernate-mapping default-access="field">
       <subclass name="com.mycomp.taskinstance.NewTaskInstance"
       <property name="someVariable1" column="SOMEVARIABLE1_" />

      When I run my unit test I see...

      INFO Configuration : Reading mappings from resource : com/mycomp/taskinstance/NewTaskInstance.hbm.xml
      INFO HbmBinder : Mapping subclass: com.mycomp.taskinstance.NewTaskInstance -> JBPM_TASKINSTANCE

      I suppose the NewTaskInstance should map to either a modified JBPM_TASKINSTANCE or to JBPM_NEWTASKINSTANCE ?

      And finally of course the test bombs out with...

      WARN JDBCExceptionReporter : SQL Error: 1054, SQLState: 42S22
      ERROR JDBCExceptionReporter : Unknown column 'newtaskins0_.SOMEVARIABLE1_' in 'field list'

      because I either have not added the new field to JBPM_TASKINSTANCE, or have not added the new table required.. (not sure which).

      If someone could give me a pointer as to the process of adding the new field in the table, or adding a new table I would appreciate it,