<br><font size=2 face="Trebuchet MS">Hi, Vijay,</font>
<br>
<br><font size=2 face="Trebuchet MS">I am not doing this to store request
object.</font>
<br><font size=2 face="Trebuchet MS"><b>loadSession.insert(request);</b></font>
<br>
<br><font size=2 face="Trebuchet MS">What I am doing is I created a pojo
class having setter and getter method of HttpServletRequest and some other
class objects &nbsp;and declare this(request) as <b>transient.</b></font>
<br><font size=2 face="Trebuchet MS">So because of that this will not get
store into the database and rest of the variables of pojo class gets way
into the database.</font>
<br><font size=2 face="Trebuchet MS">What you are telling to take the request
map and insert that , I have done that part.</font>
<br><font size=2 face="Trebuchet MS">But I have a service written in my
project which takes request object as a parameter , which I have called
in the <b>ActionWorkItemHandler </b>(custom Action Work Item made to execute
my service).</font>
<br>
<br><font size=2 face="Trebuchet MS">Now inside the <b>exceute(WorkITem
workItem, WorkItemManager manager)</b> method of <b>ActionWorkItemHandler
</b>when I am trying to </font>
<br><font size=2 face="Trebuchet MS">retrieve the request object after
loading session from the database.</font>
<br><font size=2 face="Trebuchet MS">I am getting it as <b>null, </b>which
is obvious as it was not stored in the database.</font>
<br>
<br><font size=2 face="Trebuchet MS">So I just want to know if I have a
non serilizable object , how can I pass that into the process and use this
in a custom ActionWorkItemHandler.</font>
<br><font size=2 face="Trebuchet MS">Please let me know if you understand
what I am saying.</font>
<br>
<br><font size=2 face="Trebuchet MS">Thanks &amp; Regards<br>
<br>
Pardeep Ruhil<br>
L&amp;T Infotech Ltd<br>
Mumbai<br>
Ph: +919820283884<br>
<b><br>
Larsen &amp; Toubro Infotech Ltd.</b></font><font size=2 color=blue face="Trebuchet MS"><u><br>
</u></font><a href=http://www.lntinfotech.com/><font size=2 color=blue face="Trebuchet MS"><u>www.Lntinfotech.com</u></font></a><font size=2 face="Trebuchet MS"><br>
<br>
This Document is classified as: <br>
<br>
</font><input type=checkbox name=F1_chkbox checked value=on><font size=2 face="Trebuchet MS">L&amp;T
Infotech Proprietary &nbsp; </font><input type=checkbox name=F1_chkbox value=on><font size=2 face="Trebuchet MS">L&amp;T
Infotech Confidential &nbsp; </font><input type=checkbox name=F1_chkbox value=on><font size=2 face="Trebuchet MS">L&amp;T
Infotech Internal Use Only &nbsp; </font><input type=checkbox name=F1_chkbox value=on><font size=2 face="Trebuchet MS">L&amp;T
Infotech General Business &nbsp; <br>
<br>
This Email may contain confidential or privileged information for the intended
recipient (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/19/2009 10:44 AM</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">I don’t understand what you
meant by storing the HttpServletRequest object? With the default marshalling
strategy for JPA in place I don’t think you can insert a non serializable
object? &nbsp;How come this piece of code is working fine at your end?</font>
<br><font size=2 face="Trebuchet MS"><b>loadSession.insert(request);</b></font>
<br><font size=2 color=#000080 face="Arial">&nbsp;</font>
<br><font size=2 color=#000080 face="Arial">Which set of objects are you
looking from the request? May be you want to get hold of the request parameter
map &nbsp;-- or create a list of &nbsp;attribute map and insert those instead
of HttpServletRequest object</font>
<br><font size=2 color=#000080 face="Arial">&nbsp;</font>
<br><font size=2 color=#000080 face="Arial">Am I missing something of what
you meant in your email?</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 10:15 PM<b><br>
To:</b> Vijay K Pandey; rules-users@lists.jboss.org<b><br>
Cc:</b> kris.verlaenen@cs.kuleuven.be<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 Vijay,</font><font size=3 face="Times New Roman"> </font><font size=2 face="Trebuchet MS"><br>
Thanks for your reply.</font><font size=3 face="Times New Roman"> </font><font size=2 face="Trebuchet MS"><br>
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><font size=3 face="Times New Roman">
</font><font size=2 face="Trebuchet MS"><br>
So because of this I am not able to store this object into the database.</font><font size=3 face="Times New Roman">
</font><font size=2 face="Trebuchet MS"><br>
So that's why I am asking how can i do this if my object is not serilizable.</font><font size=3 face="Times New Roman">
<br>
<br>
</font><font size=2 face="Trebuchet MS"><br>
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><font size=3 face="Times New Roman"><br>
</font>
<p>
<table width=100%>
<tr valign=top>
<td width=24%><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><font size=3 face="Times New Roman">
</font>
<td width=75%>
<br>
<table width=100%>
<tr valign=top>
<td width=5%>
<div align=right><font size=1 face="Trebuchet MS">To</font></div>
<td width=94%><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><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;kris.verlaenen@cs.kuleuven.be&quot;
&lt;kris.verlaenen@cs.kuleuven.be&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 color=#000080 face="Arial"><br>
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. <br>
 </font><font size=3 face="Times New Roman">&nbsp;</font><font size=2 color=#000080 face="Arial"><br>
So you have to load the same session – to get to your inserted objects.
<br>
 </font><font size=3 face="Times New Roman">&nbsp;</font><font size=2 color=#000080 face="Arial"><br>
There is a difference the way process map objects are handled – such as</font><font size=3 face="Times New Roman">
</font><font size=2 color=#000080 face="Arial"><br>
 </font><font size=3 face="Times New Roman">&nbsp;</font><font size=2 face="Courier New"><br>
 &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><font size=3 face="Times New Roman">
</font><font size=2 face="Courier New"><br>
 &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><font size=3 face="Times New Roman">
</font><font size=2 face="Courier New"><br>
 &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><font size=3 face="Times New Roman">
</font><font size=2 face="Courier New"><br>
 &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><font size=3 face="Times New Roman"> </font><font size=2 color=#000080 face="Arial"><br>
 </font><font size=3 face="Times New Roman">&nbsp;</font><font size=2 color=#000080 face="Arial"><br>
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><font size=3 face="Times New Roman">
</font><font size=2 color=#000080 face="Arial"><br>
 </font><font size=3 face="Times New Roman">&nbsp;</font><font size=2 color=#000080 face="Arial"><br>
Vijay</font><font size=3 face="Times New Roman"> </font>
<div align=center>
<br><font size=3 face="Times New Roman">&nbsp;</font>
<br>
<hr></div>
<br><font size=2 face="Tahoma"><b><br>
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><font size=3 face="Times New Roman">
<br>
 &nbsp;</font><font size=2 face="Trebuchet MS"><br>
<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">
</font><font size=2 face="Trebuchet MS"><br>
<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"> <br>
 </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">
</font><font size=2 face="Trebuchet MS"><br>
<br>
This session object is different from the one that is created when we first
created <br>
StatefulknowledgeSession object using </font><font size=2 face="Courier New"><br>
<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">
</font><font size=2 face="Trebuchet MS"><br>
<br>
Am I right ?</font><font size=3 face="Times New Roman"> </font><font size=2 face="Trebuchet MS"><br>
<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; 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">
</font><font size=2 face="Trebuchet MS"><br>
<br>
Kindly help in this, or I have misunderstood the concept. <br>
<br>
Thanks &amp; Regards<br>
<br>
Pardeep Ruhil</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%><font size=3 face="Times New Roman">&nbsp;</font>
<p>
<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"><br>
 &nbsp;</font>
<p><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>
<p><font size=3 face="Times New Roman"><br>
<br>
</font><font size=2 face="Courier New"><br>
<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 face="Times New Roman"><br>
______________________________________________________________________
</font>
<p><font size=3 face="Times New Roman"><br>
______________________________________________________________________</font>
<p><font size=3><br>
______________________________________________________________________</font>
<p>
<BR>
______________________________________________________________________<BR>