5 Replies Latest reply on Mar 10, 2006 2:04 PM by camunda

    Problems with setProcessDefinition over reflection and GCLIB



      we have developed a workaround to update running processes to a new version. This also needs to change the processDefinition attribute in ProcessInstance. Because there is no setter, we have done it over reflection:

       Field field = ProcessInstance.class.getDeclaredField("processDefinition");
       field.set(pi, newDef);

      Now, this does not work any more with 3.1, because of the enhanced classes (Hibernate uses CGLIB ByteCode Enhancement for Lazy Loading), as we can see in the log:

      2006-02-23 16:58:04,693 WARN [com.camunda.toolkit.jbpm.service.AdminServicesImpl] class = class org.jbpm.graph.exe.ProcessInstance$$EnhancerByCGLIB$$5835a02d
      2006-02-23 16:58:04,693 WARN [com.camunda.toolkit.jbpm.service.AdminServicesImpl] super-class = class org.jbpm.graph.exe.ProcessInstance

      The behavior is strange, we set the field (no Exception!), but after the call the processDefinition has not changed!

      How can we set this field over reflection of the GCLIB? Google has not helped very much on this issue :-(

      Thanks for hints!