2 Replies Latest reply on Jun 3, 2015 10:51 AM by Chris Pike

    Help storing process variables using JPA

    Chris Pike Newbie

      I'm following this blog posts instructions for using the JPA Placeholder Strategy (http://mswiderski.blogspot.com/2014/02/jbpm-6-store-your-process-variables.html). I have my process bundled as a kjar which has the model class defined along with a persistence.xml file. The kjar is deployed to the console running in wildfly. When I start the process using the remote API, I get this error

       

      org.hibernate.MappingException: Unknown entity: test.model.ExampleOrder

       

      It makes sense that the console isn't aware of this entity since it's not in the console's persistence.xml. However, I'm not sure how to setup my environment correctly. I would like each kjar I deploy to define the entities.

        • 1. Re: Help storing process variables using JPA
          Maciej Swiderski Master

          take a look at this example project that does exactly the thing you need. Note two main aspect of this project:

          • utility class and extended JPAPlaceholderResolverStrategy that can be found here these are required to make sure hibernate will find entities from the kjar - in 6.3 this will already be in regular code base so no need for extra classes in kjar but for 6.2 they are still required
          • defined marshaling strategy in deployment descriptor that refers to extended implementation and pass the classLoader

           

          With that you should be able to store entities from the project with jpa as process variables

           

          HTH

          • 2. Re: Help storing process variables using JPA
            Chris Pike Newbie

            Maciej,

             

            I was able to use your example and create new processes with my custom JPA entity. However, I'm having problems using the remote API to retrieve the variable.

             

            When I hit the rest endpoint

             

            /rest/task/11/content?deploymentId=myDeploymentId

             

            I see this warning in the log

             

            Exception while unmarshaling content: java.lang.IllegalStateException: No strategy of type persistence.ProjectJPAResolverStrategy available.

             

            I do get a response with a long content string but I don't know how to deserialize it.