<div><font size="3"><font face="Times New Roman">
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;">Hi,</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;"> </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;">      I am evaluating the drools expert with drool flow using TimeManagement System. I am inserting the process instance into working memory of drools [session.insert(workflowProcessInstance)]  So that the rules can use the process instance as part of Rule constraints to enable the rules to make more sophisticated decisions based on the state of the current process instance.</span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;"> </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;">Rule snippet</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;"> </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;">rule &quot;Submit Time&quot;  ruleflow-group &quot;Submit Time&quot;<br>       dialect &quot;java&quot;<br>       when<br>
<br>               processInstance:WorkflowProcessInstance()</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;">               tkRequest:TKRequest ()<br>               tkRequestDAO:TKRequestDAO()<br>       then</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;">                    // check the current processInstance state as Active then do that</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;">                       //Do custom operation, status change, persistence update  </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;">       end</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;"> </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;">       The approach is works fine with using KnowledgeBuilder.newStatefulKnowledgeSession() that is no persistence.  But once i have enabled the Persistence using JPAKnowledgeService.newStatefulKnowledgeSession(know, null, getEnvironment())  it throws stack over flow error due the workflowProcessInstance is not serialized while trying to persist the newly added workflowProcessInstance  to working memory. </span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;"> </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;">           Once i have commented the session.insert(workflowProcessInstance) the stack overflow error is gone but none of my rules are not executed.  </span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;"> </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;">Can some one provide guidance on how to pass this workflowProcessInstance to rule constriant with persistence JPAKnowledgeSession enabled.</span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;"> </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;">Thanks</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-FAMILY: &#39;Trebuchet MS&#39;">Prem</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"></p></font></font></div>
<div> </div>