<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"> </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"> 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 <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"> Collection
obj = loadSession.getObject();</font>
<br><font size=2 face="Trebuchet MS">I get request as <b>null. </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 & 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 <kris.verlaenen@cs.kuleuven.be></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 <rules-users@lists.jboss.org>,
Vijay K Pandey <VPandey@mdes.ms.gov></font>
<tr valign=top>
<td>
<div align=right><font size=1 face="Trebuchet MS">cc</font></div>
<td><font size=1 face="Trebuchet MS">"Pardeep.Ruhil@lntinfotech.com"
<Pardeep.Ruhil@lntinfotech.com></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>
Or you could have multiple independent sessions as well. 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 <VPandey@mdes.ms.gov>:<br>
<br>
> Let's say where we don't need timers - in those cases one can create<br>
> (create only if its not there) a global session (create the<br>
> sessioninfo at the drools startup - store the session primary key<br>
> somewhere) - reuse this session across everywhere?<br>
> <br>
> Vijay<br>
> -----Original Message-----<br>
> From: rules-users-bounces@lists.jboss.org<br>
> [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Kris<br>
> Verlaenen<br>
> Sent: Monday, November 16, 2009 5:12 PM<br>
> To: Rules Users List; Pardeep.Ruhil@lntinfotech.com<br>
> Subject: Re: [rules-users] Drools Flow :Persistence Problem : Restore<br>
> StatefulKnowledgeSession from database<br>
> <br>
> Pardeep,<br>
> <br>
> The behavior you are describing is indeed correct. The session
in<br>
> this<br>
> case is a global session, meaning that it will be used for all<br>
> process<br>
> instances. Note however that, unless you are using timers, all<br>
> other<br>
> state (process instance state, work items, etc.) is persisted<br>
> separately<br>
> and the session state will basically be empty.<br>
> <br>
> It is also possible to have one session per process instance (or<br>
> whatever partitioning you like). A session has a unique id (which<br>
> you<br>
> can specify when reloading the session). You'll then have to
load<br>
> the<br>
> right session before continuing the execution of your process<br>
> instance.<br>
> <br>
> Kris<br>
> <br>
> Quoting Pardeep.Ruhil@lntinfotech.com:<br>
> <br>
> > Hi Salaboy,<br>
> > Thanks for you replying.<br>
> > Yes, of course it is storing multiple process instance Id in
the<br>
> > database.<br>
> > But, what I feel is that it will fail when I am trying to run
two<br>
> > workflow<br>
> > at the same time simultaneously, using the same code by<br>
> dynamically<br>
> > providing the workflow name and the parameters for each of them.<br>
> > Ideally there should be two entries for the<br>
> StatfulKnowledgeSession<br>
> > object<br>
> > because when I try to load the StatefulKnowledgeSession object<br>
> from<br>
> > the<br>
> > database it will give me the session object of the workflow which<br>
> is<br>
> > last<br>
> > executed.<br>
> ><br>
> > For example lets suppose I have two workflow 1 and 2 having
two<br>
> > humantask<br>
> > in each of them . So when I finish the first Human Task of both<br>
> > workflow<br>
> > one by one. SessionInfo present in the database is
of workflow 2<br>
> > (if 2<br>
> > is executed last). Because there is no field in the sessioninfo<br>
> > entity of<br>
> > the database regarding to which workflow it belongs to. Am I
right<br>
> ?<br>
> > So when I try to finish the 1st workflow by executing the
2nd<br>
> > humantask<br>
> > left in it , I need to reload the StatfulKnowledgeSession object<br>
> from<br>
> > the<br>
> > database. As there is no way of distinguishing that the session<br>
> > object<br>
> > store in the database is of which workflow , there might be a<br>
> problem<br>
> > as I<br>
> > may get the ksession object of 2nd workflow.<br>
> ><br>
> > In case of Process Instance it is fine , because there is a field<br>
> > 'processId' which will distinguish which processInstanceId belongs<br>
> to<br>
> ><br>
> > which worklowId or processId.<br>
> > But in case of Session , there is noting as such.<br>
> > I don't what I am saying is handled in drools persistence. Please<br>
> let<br>
> > me<br>
> > know if it there or not.<br>
> ><br>
> > Thanks & Regards<br>
> ><br>
> > Pardeep Ruhil<br>
> ><br>
> ><br>
> ><br>
> ______________________________________________________________________<br>
> <br>
> <br>
> <br>
> <br>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm<br>
> _______________________________________________<br>
> rules-users mailing list<br>
> rules-users@lists.jboss.org<br>
> https://lists.jboss.org/mailman/listinfo/rules-users<br>
> _______________________________________________<br>
> rules-users mailing list<br>
> rules-users@lists.jboss.org<br>
> https://lists.jboss.org/mailman/listinfo/rules-users<br>
> <br>
<br>
<br>
<br>
<br>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm<br>
<br>
______________________________________________________________________<br>
</font></tt>
<br>
<BR>
______________________________________________________________________<BR>