<br><font size=2 face="Trebuchet MS">Hi Vijay,</font>
<br><font size=2 face="Trebuchet MS">Thanks for your reply.</font>
<br><font size=2 face="Trebuchet MS">The problem is that object that I
am inserting it into the session object is NOT serializable, as you know
HttpServletRequest object is not serializable.</font>
<br><font size=2 face="Trebuchet MS">So because of this I am not able to
store this object into the database.</font>
<br><font size=2 face="Trebuchet MS">So that's why I am asking how can
i do this if my object is not serilizable.</font>
<br>
<br>
<br><font size=2 face="Trebuchet MS">Thanks &amp; Regards<br>
<br>
Pardeep Ruhil<br>
nt (s) If you are not the intended recipient, please do not use or disseminate
the information, notify the sender and delete it from your system. </font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="Trebuchet MS"><b>Vijay K Pandey &lt;VPandey@mdes.ms.gov&gt;</b>
</font>
<p><font size=1 face="Trebuchet MS">11/18/2009 10:56 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">&quot;Pardeep.Ruhil@lntinfotech.com&quot;
&lt;Pardeep.Ruhil@lntinfotech.com&gt;, &quot;rules-users@lists.jboss.org&quot;
&lt;rules-users@lists.jboss.org&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;kris.verlaenen@cs.kuleuven.be&quot;
&lt;kris.verlaenen@cs.kuleuven.be&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><font size=2 color=#000080 face="Arial">You have to load the same ‘<b>StatefulKnowledgeSession</b>’
in which you have inserted your objects</font><font size=2 face="Courier New">.
</font><font size=2 color=#000080 face="Arial">The inserted objects are
serialized and stored in the column “<b>rules_byte_array</b>” of the
<b>session_info</b> table. </font>
<br><font size=2 color=#000080 face="Arial">&nbsp;</font>
<br><font size=2 color=#000080 face="Arial">So you have to load the same
session – to get to your inserted objects. </font>
<br><font size=2 color=#000080 face="Arial">&nbsp;</font>
<br><font size=2 color=#000080 face="Arial">There is a difference the way
process map objects are handled – such as</font>
<br><font size=2 color=#000080 face="Arial">&nbsp;</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; Map&lt;String,
Object&gt; parameters = </font><font size=2 color=#820040 face="Courier New"><b>new</b></font><font size=2 face="Courier New">
HashMap&lt;String, Object&gt;();</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; parameters.put(</font><font size=2 color=#4200ff face="Courier New">&quot;x&quot;</font><font size=2 face="Courier New">,
</font><font size=2 color=#4200ff face="Courier New">&quot;hello&quot;</font><font size=2 face="Courier New">);</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; parameters.put(</font><font size=2 color=#4200ff face="Courier New">&quot;y&quot;</font><font size=2 face="Courier New">,
</font><font size=2 color=#4200ff face="Courier New">&quot;hey I am y&quot;</font><font size=2 face="Courier New">);</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; ksession.startProcess(
</font><font size=2 color=#4200ff face="Courier New">&quot;myprocess&quot;</font><font size=2 face="Courier New">,
parameters );</font>
<br><font size=2 color=#000080 face="Arial">&nbsp;</font>
<br><font size=2 color=#000080 face="Arial">In the above case the parameters
are not stored as part of the “session info” table. These are stored
separately like in “process instance info” table + (some/other tables
if you use variable persistence strategy)– so if you don’t have the rules
which are based on the objects you are inserting – you can get the same
done through process parameters in which case you can get hold of the process
instance through &nbsp;any new session or the same session and then its
parameters.</font>
<br><font size=2 color=#000080 face="Arial">&nbsp;</font>
<br><font size=2 color=#000080 face="Arial">Vijay</font>
<div align=center>
<br>
<hr></div>
<br><font size=2 face="Tahoma"><b>From:</b> Pardeep.Ruhil@lntinfotech.com
[mailto:Pardeep.Ruhil@lntinfotech.com] <b><br>
Sent:</b> Wednesday, November 18, 2009 12:38 AM<b><br>
To:</b> rules-users@lists.jboss.org<b><br>
Cc:</b> kris.verlaenen@cs.kuleuven.be; Vijay K Pandey<b><br>
Subject:</b> Re: [rules-users] Drools Flow :Persistence Problem : Restore
StatefulKnowledgeSession from database</font>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br><font size=2 face="Trebuchet MS"><br>
Hi Kris,</font><font size=3 face="Times New Roman"> </font><font size=2 face="Trebuchet MS"><br>
Thanks for you valuable input and Vijay of course clearing some of my doubts
by asking question on this.</font><font size=3 face="Times New Roman">
<br>
</font><font size=2 face="Trebuchet MS"><br>
Much of my doubt are clear except one. <br>
When we are reloading the StatefulKnowledgeSession from the database using
the below line</font><font size=3 face="Times New Roman"> </font><font size=2 face="Courier New"><br>
 </font><font size=3 face="Times New Roman">&nbsp;</font><font size=2 face="Courier New"><br>
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><font size=3 face="Times New Roman">
<br>
</font><font size=2 face="Trebuchet MS"><br>
This session object is different from the one that is created when we first
created <br>
StatefulknowledgeSession object using </font><font size=3 face="Times New Roman"><br>
</font><font size=2 face="Courier New"><br>
 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><font size=3 face="Times New Roman">
<br>
</font><font size=2 face="Trebuchet MS"><br>
Am I right ?</font><font size=3 face="Times New Roman"> <br>
</font><font size=2 face="Trebuchet MS"><br>
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><font size=3 face="Times New Roman">
</font><font size=2 face="Trebuchet MS"><br>
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><br>
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. <br>
I am not able to retrieve the same request object i.e. (HttpServletRequest)
from the session in ActionWorkItemHandler <br>
as when i do <br>
 &nbsp; &nbsp; &nbsp; &nbsp;Collection obj = loadSession.getObject();</font><font size=3 face="Times New Roman">
</font><font size=2 face="Trebuchet MS"><br>
I get request as <b>null. &nbsp;</b> Because this loadSession is different
from the one I have inserted.</font><font size=3 face="Times New Roman">
<br>
</font><font size=2 face="Trebuchet MS"><br>
Kindly help in this, or I have misunderstood the concept. </font><font size=3 face="Times New Roman"><br>
</font><font size=2 face="Trebuchet MS"><br>
Thanks &amp; Regards<br>
<br>
Pardeep Ruhil</font><font size=3 face="Times New Roman"><br>
<br>
</font>
<p>
<table width=100%>
<tr valign=top>
<td width=33%><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><font size=3 face="Times New Roman">
</font>
<td width=66%>
<br>
<table width=100%>
<tr valign=top>
<td width=6%>
<div align=right><font size=1 face="Trebuchet MS">To</font></div>
<td width=93%><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><font size=3 face="Times New Roman">
</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><font size=3 face="Times New Roman">
</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><font size=3 face="Times New Roman">&nbsp;</font>
<p>
<br>
<table>
<tr valign=top>
<td><font size=3 face="Times New Roman">&nbsp;</font>
<td><font size=3 face="Times New Roman">&nbsp;</font></table>
<br></table>
<br><font size=3 face="Times New Roman"><br>
<br>
</font><font size=2 face="Courier New"><br>
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. &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>
______________________________________________________________________</font><font size=3 face="Times New Roman"><br>
<br>
<br>
______________________________________________________________________</font>
<p><font size=3><br>
______________________________________________________________________</font>
<p>
<BR>
______________________________________________________________________<BR>