<br><font size=2 face="Trebuchet MS">Hi Kris,</font>
<br><font size=2 face="Trebuchet MS">Thanks for you valuable input and
Vijay of course clearing some of my doubts by asking question on this.</font>
<br>
<br><font size=2 face="Trebuchet MS">Much of my doubt are clear except
one. </font>
<br><font size=2 face="Trebuchet MS">When we are reloading the StatefulKnowledgeSession
from the database using the below line</font>
<br><font size=2 face="Courier New">&nbsp;</font>
<br><font size=2 face="Courier New">StatefulKnowledgeSession loadSession=
JPAKnowledgeService.<i>loadStatefulKnowledgeSession</i>(id, </font><font size=2 color=#0021bf face="Courier New"><i>kbase</i></font><font size=2 face="Courier New">,
</font><font size=2 color=#820040 face="Courier New"><b>null</b></font><font size=2 face="Courier New">,
</font><font size=2 color=#0021bf face="Courier New"><i>env</i></font><font size=2 face="Courier New">);</font>
<br>
<br><font size=2 face="Trebuchet MS">This session object is different from
the one that is created when we first created </font>
<br><font size=2 face="Trebuchet MS">StatefulknowledgeSession object using
</font>
<br>
<br><font size=2 face="Courier New">&nbsp;StatefulKnowledgeSession <b>initialSession</b>=
JPAKnowledgeService.<i>newStatefulKnowledgeSession</i>(</font><font size=2 color=#0021bf face="Courier New"><i>kbase</i></font><font size=2 face="Courier New">,
</font><font size=2 color=#820040 face="Courier New"><b>null</b></font><font size=2 face="Courier New">,
</font><font size=2 color=#0021bf face="Courier New"><i>env</i></font><font size=2 face="Courier New">);</font>
<br>
<br><font size=2 face="Trebuchet MS">Am I right ?</font>
<br>
<br><font size=2 face="Trebuchet MS">Now In my case I have a <b>HumanWorkItemHandler</b>
class for handling the <b>humantask</b> and there is<b> ActionWorkITemHandle</b>r
for my customAction workItem, which both are initailsed with the <b>initialSession
</b>object.</font>
<br><font size=2 face="Trebuchet MS">Now when I load the session from the
database to complete the HumanWorkItemHandler task I got a different session
object i.e. <b>loadSession. </b></font>
<br><font size=2 face="Trebuchet MS">Now when I insert something in the
loadsession using &nbsp;<b>loadSession.insert(request);</b> So that I can
use the same in ActionWorkItemHandler to exceute the action for the request.
</font>
<br><font size=2 face="Trebuchet MS">I am not able to retrieve the same
request object i.e. (HttpServletRequest) from the session in ActionWorkItemHandler
</font>
<br><font size=2 face="Trebuchet MS">as when i do </font>
<br><font size=2 face="Trebuchet MS">&nbsp; &nbsp; &nbsp; &nbsp; Collection
obj = loadSession.getObject();</font>
<br><font size=2 face="Trebuchet MS">I get request as <b>null. &nbsp;</b>
Because this loadSession is different from the one I have inserted.</font>
<br>
<br><font size=2 face="Trebuchet MS">Kindly help in this, or I have misunderstood
the concept. </font>
<br>
<br><font size=2 face="Trebuchet MS">Thanks &amp; Regards<br>
<br>
Pardeep Ruhil<br>
</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="Trebuchet MS"><b>Kris Verlaenen &lt;kris.verlaenen@cs.kuleuven.be&gt;</b>
</font>
<p><font size=1 face="Trebuchet MS">11/17/2009 04:17 PM</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="Trebuchet MS">To</font></div>
<td><font size=1 face="Trebuchet MS">Rules Users List &lt;rules-users@lists.jboss.org&gt;,
Vijay K Pandey &lt;VPandey@mdes.ms.gov&gt;</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="Trebuchet MS">cc</font></div>
<td><font size=1 face="Trebuchet MS">&quot;Pardeep.Ruhil@lntinfotech.com&quot;
&lt;Pardeep.Ruhil@lntinfotech.com&gt;</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="Trebuchet MS">Subject</font></div>
<td><font size=1 face="Trebuchet MS">Re: [rules-users] Drools Flow :Persistence
Problem : Restore StatefulKnowledgeSession from database</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><tt><font size=2>Preferably you should cache the session itself as
well (so you don't<br>
have to recreate it all the time) and reuse that across you application.<br>
 &nbsp;Or you could have multiple independent sessions as well. &nbsp;If
you store<br>
the key of the session somewhere, you can easily restore this session<br>
(or sessions) after failure.<br>
<br>
Kris<br>
<br>
Quoting Vijay K Pandey &lt;VPandey@mdes.ms.gov&gt;:<br>
<br>
&gt; Let's say where we don't need timers - in those cases one can create<br>
&gt; (create only if its not there) a global session (create the<br>
&gt; sessioninfo at the drools startup - store the session primary key<br>
&gt; somewhere) - reuse this session across everywhere?<br>
&gt; <br>
&gt; Vijay<br>
&gt; -----Original Message-----<br>
&gt; From: rules-users-bounces@lists.jboss.org<br>
&gt; [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Kris<br>
&gt; Verlaenen<br>
&gt; Sent: Monday, November 16, 2009 5:12 PM<br>
&gt; To: Rules Users List; Pardeep.Ruhil@lntinfotech.com<br>
&gt; Subject: Re: [rules-users] Drools Flow :Persistence Problem : Restore<br>
&gt; StatefulKnowledgeSession from database<br>
&gt; <br>
&gt; Pardeep,<br>
&gt; <br>
&gt; The behavior you are describing is indeed correct. &nbsp;The session
in<br>
&gt; this<br>
&gt; case is a global session, meaning that it will be used for all<br>
&gt; process<br>
&gt; instances. &nbsp;Note however that, unless you are using timers, all<br>
&gt; other<br>
&gt; state (process instance state, work items, etc.) is persisted<br>
&gt; separately<br>
&gt; and the session state will basically be empty.<br>
&gt; <br>
&gt; It is also possible to have one session per process instance (or<br>
&gt; whatever partitioning you like). &nbsp;A session has a unique id (which<br>
&gt; you<br>
&gt; can specify when reloading the session). &nbsp;You'll then have to
load<br>
&gt; the<br>
&gt; right session before continuing the execution of your process<br>
&gt; instance.<br>
&gt; <br>
&gt; Kris<br>
&gt; <br>
&gt; Quoting Pardeep.Ruhil@lntinfotech.com:<br>
&gt; <br>
&gt; &gt; Hi Salaboy,<br>
&gt; &gt; Thanks for you replying.<br>
&gt; &gt; Yes, of course it is storing multiple process instance Id in
the<br>
&gt; &gt; database.<br>
&gt; &gt; But, what I feel is that it will fail when I am trying to run
two<br>
&gt; &gt; workflow<br>
&gt; &gt; at the same time simultaneously, using the same code by<br>
&gt; dynamically<br>
&gt; &gt; providing the workflow name and the parameters for each of them.<br>
&gt; &gt; Ideally there should be two entries for the<br>
&gt; StatfulKnowledgeSession<br>
&gt; &gt; object<br>
&gt; &gt; because when I try to load the StatefulKnowledgeSession object<br>
&gt; from<br>
&gt; &gt; the<br>
&gt; &gt; database it will give me the session object of the workflow which<br>
&gt; is<br>
&gt; &gt; last<br>
&gt; &gt; executed.<br>
&gt; &gt;<br>
&gt; &gt; For example lets &nbsp;suppose I have two workflow 1 and 2 having
two<br>
&gt; &gt; humantask<br>
&gt; &gt; in each of them . So when I finish the first Human Task of both<br>
&gt; &gt; workflow<br>
&gt; &gt; one by one. &nbsp;SessionInfo &nbsp;present in the database is
of workflow 2<br>
&gt; &gt; (if 2<br>
&gt; &gt; is executed last). Because there is no field in the sessioninfo<br>
&gt; &gt; entity of<br>
&gt; &gt; the database regarding to which workflow it belongs to. Am I
right<br>
&gt; ?<br>
&gt; &gt; So when I &nbsp;try to finish the 1st workflow by executing the
2nd<br>
&gt; &gt; humantask<br>
&gt; &gt; left in it , I need to reload the StatfulKnowledgeSession object<br>
&gt; from<br>
&gt; &gt; the<br>
&gt; &gt; database. As there is no way of distinguishing that the session<br>
&gt; &gt; object<br>
&gt; &gt; store in the database is of which workflow , there might be a<br>
&gt; problem<br>
&gt; &gt; as I<br>
&gt; &gt; may get the ksession object of 2nd workflow.<br>
&gt; &gt;<br>
&gt; &gt; In case of Process Instance it is fine , because there is a field<br>
&gt; &gt; 'processId' which will distinguish which processInstanceId belongs<br>
&gt; to<br>
&gt; &gt;<br>
&gt; &gt; which worklowId or processId.<br>
&gt; &gt; But in case of Session , there is noting as such.<br>
&gt; &gt; I don't what I am saying is handled in drools persistence. Please<br>
&gt; let<br>
&gt; &gt; me<br>
&gt; &gt; know if it there or not.<br>
&gt; &gt;<br>
&gt; &gt; Thanks &amp; Regards<br>
&gt; &gt;<br>
&gt; &gt; Pardeep Ruhil<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; ______________________________________________________________________<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; rules-users@lists.jboss.org<br>
&gt; https://lists.jboss.org/mailman/listinfo/rules-users<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; rules-users@lists.jboss.org<br>
&gt; https://lists.jboss.org/mailman/listinfo/rules-users<br>
&gt; <br>
<br>
<br>
<br>
<br>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm<br>
<br>
______________________________________________________________________<br>
</font></tt>
<br>
<BR>
______________________________________________________________________<BR>