5 Replies Latest reply on May 20, 2015 2:56 AM by swiderski.maciej

    JPAPlaceholderResolverStrategy issue

    cristian.blanaru

      Hi

       

      I am running JBPM 6.2 on JBOSS EAP 6.3.2 by using jbpm-services-ejb.

      Now I am trying persist custom variables to the database by using JPAPlaceholderResolverStrategy.

      The problem I am facing is that at marshalling new variables, the variable ID is serialized to process instance info, but the variable is not persisted in its custom table.

      If in JPAPlaceholderResolverStrategy, I add the entity manager flush on the marshalling new variable case

       

      if (id == null) {

                  em.persist(object);

                  id = getClassIdValue(object);

                  em.flush();

              } else {

                  em.merge(object);

                  // since this is invoked by marshaller it's safe to call flush

                  // and it's important to be flushed so subsequent unmarshall operations

                  // will get update content especially when merged

                  em.flush();

              }

       

      everything works fine.

       

      Do you have any thoughts on this issue ?

       

      Thanks

        • 1. Re: JPAPlaceholderResolverStrategy issue
          swiderski.maciej

          how do you configure that marshaling strategy and entity manager factory?

           

          Could it be that marshaling is done after JPA provider has already processed it's beforeCompletion phases? That is the only idea that comes to my mind which might be causing entries not persisted even though they were properly added to persistence context.

           

          HTH

          • 2. Re: JPAPlaceholderResolverStrategy issue
            cristian.blanaru

            The marshalling strategy is configured in the kmodule's deployment descriptor

            ...

                <marshalling-strategies>

                    <marshalling-strategy>

                        <resolver>reflection</resolver>

                        <identifier>com.myejb.JPAPlaceholderResolverStrategy</identifier>

                        <parameters>

                            <parameter xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">entityManagerFactory</parameter>

                        </parameters>

                    </marshalling-strategy>

                </marshalling-strategies>

            ....

             

            Attached is the persistence.xml

            • 3. Re: JPAPlaceholderResolverStrategy issue
              swiderski.maciej

              all looks ok, so the only explanation I can see here is that the pa provider processes all entities from persistence context before the marshaling is invoked. If you could create jira and add a test cases into jbpm-services-ejb-impl (as pull request) with your case that would be great. Feel free to add the fix into JPAPlaceholderResolverStrategy

               

              HTH

              • 4. Re: JPAPlaceholderResolverStrategy issue
                clp207

                Maciej,

                 

                How would I add the the default SerializablePlaceholderResolverStrategy into the deployment descriptor after the JPAPlaceholderResolverStrategy?


                I've tried this, but it doesn't work


                <marshalling-strategy>

                <resolver>reflection</resolver>

                <identifier>org.drools.core.marshalling.impl.SerializablePlaceholderResolverStrategy</identifier>

                <parameters>

                <parameter xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">objectMarshallingStrategyAcceptor</parameter>

                </parameters>

                </marshalling-strategy>

                 

                Thanks!

                • 5. Re: JPAPlaceholderResolverStrategy issue
                  swiderski.maciej

                  Chris,

                   

                  it's there by default added at the end of all possible strategies so there is no need to add it manually

                   

                  HTH