Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-3398

SessionInfo does not store entity references correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • jBPM 5.2
    • jBPM 5.1
    • Runtime Engine
    • None
    • Hide

      Create a process with Human Task (that does not complete) and variables (with @Entity annotation but without Serializable). Start process (such that process is active), and then call ksession.dispose().

      Show
      Create a process with Human Task (that does not complete) and variables (with @Entity annotation but without Serializable). Start process (such that process is active), and then call ksession.dispose().

      While implementing my own persistency solution (I'm using a custom ORM that is not JPA-compliant), I have spotted an error while storing SessionInfo into database (I'm using persistence strategy to store session and process instance info into a database).
      The error was like this:
      java.io.NotSerializableException: hr.mnorsic.test.bo.SomeClass

      At first, it seems that my class does not implement java.io.Serializable. But I was curious to see why I have to implement Serializable, because my persistence strategy already knows that it is stored into a database, and only needs to fetch instance Id and store it into a database (I did it the similar way as in JPAPlaceholderResolverStrategy)?
      Deloving more deeply into a jBPM code, it seems that RuleFlowProcessInstance is not properly persisted (because subContextInstance contains these objects), because it stores the whole object, insted of storing object references only.
      And as a consequence, we have two object instances: one stored into a ProcessInstance (only a reference to an object) and one in SessionInfo (as a serialized object).

      The solution is one of the following:
      1. custom serialization strategy for RuleFlowProcessInstance (for subContextInstance map), or
      2. custom Map implementation that uses custom serialization strategy (both approaches should use object marshalling strategy for each object in a Map)

              marco.rietveld Marco Rietveld (Inactive)
              mnorsic Miljenko Norsic (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: