<br>    Did you tried this?<br><br>       when<br>
                 $m : MessageAsEvent(uuid==&quot;mesC:7&quot;)<br>                $o :  MessageAsEvent(uuid==&quot;mesC:7&quot;, id!=$<a href="http://m.id/" target="_blank">m.id</a>) from hibernateSession.createQuery(&quot;from MessageAsEvent where serial=?&quot;).setParameter(0,$m.serial).list()<br>
       then<br>                insert($o)<br>       end<br><br>    In any case, collect should work too. Which version of drools are you using?<br><br>    []s<br>    Edson<br><br><div class="gmail_quote">2009/10/29 richarda <span dir="ltr">&lt;<a href="mailto:richard.ambridge@gmail.com">richard.ambridge@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Hi again,<br>
<br>
I wish to have a rule that when an Event has a certain uuid then load into<br>
working memory all other events that have been received for this unit...<br>
<br>
So I write the rule:<br>
<br>
rule &quot;Repeating&quot;<br>
<br>
        when<br>
                 $m : MessageAsEvent(uuid==&quot;mesC:7&quot;)<br>
                 $others : LinkedList() from collect (<br>
                           MessageAsEvent(uuid==&quot;mesC:7&quot;, id!=$<a href="http://m.id" target="_blank">m.id</a>)<br>
                               from hibernateSession.createQuery(&quot;from MessageAsEvent where<br>
serial=?&quot;).setParameter(0,$m.serial).list()<br>
                        )<br>
        then<br>
                System.out.println(&quot;Gathering m=&quot;+$m+&quot; data=&quot;+$others);<br>
end<br>
<br>
<br>
Audit log shows: (wish cut and paste would work from Eclipse audit view)<br>
<br>
  &lt;activationId&gt;Repeating [131, 14]&lt;/activationId&gt;<br>
  &lt;rule&gt;Repeating FAN&lt;/rule&gt;<br>
  &lt;declarations&gt;$others=[MessageAsEvent:[124] uuid=mesC:7 serial=serial123<br>
count=7, MessageAsEvent:[94] uuid=mesC:7 serial=serial123 count=7,<br>
MessageAsEvent:[64] uuid=mesC:7 serial=serial123 count=7,<br>
MessageAsEvent:[118] uuid=mesC:7 serial=serial123 count=7,<br>
MessageAsEvent:[112] uuid=mesC:7 serial=serial123 count=7,<br>
MessageAsEvent:[106] uuid=mesC:7 serial=serial123 count=7,<br>
MessageAsEvent:[100] uuid=mesC:7 serial=serial123 count=7,<br>
MessageAsEvent:[88] uuid=mesC:7 serial=serial123 count=7,<br>
MessageAsEvent:[82] uuid=mesC:7 serial=serial123 count=7,<br>
MessageAsEvent:[76] uuid=mesC:7 serial=serial123 count=7,<br>
MessageAsEvent:[70] uuid=mesC:7 serial=serial123 count=7,<br>
MessageAsEvent:[58] uuid=mesC:7 serial=serial123 count=7,<br>
MessageAsEvent:[52] uuid=mesC:7 serial=serial123 count=7,<br>
MessageAsEvent:[46] uuid=mesC:7 serial=serial123 count=7,<br>
MessageAsEvent:[40] uuid=mesC:7 serial=serial123 count=7,<br>
MessageAsEvent:[34] uuid=mesC:7 serial=serial123 count=7](131);<br>
$m=MessageAsEvent:[130] uuid=mesC:7 serial=serial123<br>
count=7(14)&lt;/declarations&gt;<br>
  &lt;ruleFlowGroup&gt;Gathering&lt;/ruleFlowGroup&gt;<br>
<br>
<br>
<br>
So, you can see that the rule fired with $others having all the data,  and<br>
$m being the main uuid<br>
<br>
<br>
but the output of the rule is:<br>
Gathering m=MessageAsEvent:[130] uuid=mesC:7 serial=serial123 count=7<br>
data=null<br>
<br>
so, the $others has been translated to a null.<br>
<br>
I&#39;m trying to copy the Expert example:<br>
<br>
import java.util.LinkedList;<br>
<br>
rule &quot;Send a message to all mothers&quot;<br>
when<br>
    $town : Town( name == &#39;Paris&#39; )<br>
    $mothers : LinkedList()<br>
               from collect( Person( gender == &#39;F&#39;, children &gt; 0 )<br>
                             from $town.getPeople()<br>
                           )<br>
then<br>
    # send a message to all mothers<br>
end<br>
<br>
which indicates that $mothers will be available in the RHS<br>
<br>
for reference, the audit log shows when the rule fires:<br>
<br>
<br>
&lt;org.drools.audit.event.ActivationLogEvent&gt;<br>
  &lt;type&gt;6&lt;/type&gt;<br>
  &lt;activationId&gt;Repeating [-1, 14]&lt;/activationId&gt;<br>
  &lt;rule&gt;Repeating FAN&lt;/rule&gt;<br>
  &lt;declarations&gt;$m=MessageAsEvent:[130] uuid=mesC:7 serial=serial123<br>
count=7(14)&lt;/declarations&gt;<br>
  &lt;ruleFlowGroup&gt;Gathering&lt;/ruleFlowGroup&gt;<br>
<br>
<br>
What am I doing wrong?<br>
I basically want all the MessageAsEvent added to working memory, so later<br>
other rules will do work on all the events.<br>
<br>
Cheers<br>
Ric<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://www.nabble.com/Collect-and-hibernate-tp26112042p26112042.html" target="_blank">http://www.nabble.com/Collect-and-hibernate-tp26112042p26112042.html</a><br>
Sent from the drools - user mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>