2 Replies Latest reply on Dec 9, 2009 4:25 AM by juanignaciosl

    Entity variable

    juanignaciosl

      I'm developing a Seam/jBPM4 web application. I can already hot deploy processes through the web interface, start and signal processes, storing String and Integer variables within them...

      My problem arises when I try to attach and store an entity variable. My application and jBPM share the same datasource, but I know mine uses JPA and jBPM uses Hibernate, so there's sort of mismatch. I tried the no-brainer: adding my entity as a variable and saving, but it obviously won't work:

      org.hibernate.HibernateException: instance not of expected entity type: org.jbpm.pvm.internal.type.variable.UnpersistableVariable is not a: org.jbpm.pvm.internal.type.Variable


      I've debugged jBPM code and I've reached org.jbpm.pvm.internal.type.matcher.HibernateIdMatcher. The line where my variable will become "UnpersistableVariable" is sessionFactory.getClassMetadata(value.getClass()), which will return null.

      How should I configure class metadata?
      Can I share the entity between jBPM and Seam?
      Can I somehow hot deploy classes and metadata? (maybe in a .bar file)

      I've searched through the documentation and examples, but there's not much information on hibernate entities as variables.

      Thank you in advance!

        • 1. Re: Entity variable
          kukeltje

          It can be saved by jBPM if it is serializable. Other options will be worked out in future releases of jBPM.

          • 2. Re: Entity variable
            juanignaciosl

            Neat. As I read at the documentation it's likely that I should be able to save as an Hibernate entity, but Serializable is good enough for the time being.

            Nevertheless, when I make it Serializable it gets stored but it can't be loaded, taskService.getVariables throws the following exception:

            org.jbpm.api.JbpmException: couldn't deserialize object
            (...)
            org.jbpm.api.JbpmException: couldn't deserialize object
             Caused by: java.lang.ClassNotFoundException
            


            I'm trying to deploy the .class file inside a .bar or .jar together with the jpdl and deploying it with createDeployment() .addResourcesFromZipInputStream(zip), but the class won't get deployed.