Hmmmm... this may be the way it works, but it&#39;s not clear from the documentation-<br><br>&quot;The Conditional Element <code class="literal">from</code> enables users to
        specify an arbitrary source for data to be matched by LHS patterns.
        This allows the engine to reason over data not in the Working Memory.
        The data source could be a sub-field on a bound variable or the
        results of a method call. It is a powerful construction that allows
        out of the box integration with other application components and
        frameworks. One common example is the integration with data retrieved
        on-demand from databases using hibernate named queries.&quot;<br><br>I therefore assume &quot;...or the results of a method call&quot; should mean &quot;...or the results of a method call on a Fact&quot; and the following should work:-<br>
<br><span style="font-family: courier new,monospace;">rule &quot;dao&quot;<br>  when<br>    $cs : CustomerRepository( )<br>    k : Customer(  ) from $cs.getCustomerService().findAll()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  then</span><span style="font-family: courier new,monospace;"><br>    System.out.println( &quot;Drools &quot;+drools.getRule().getName()+&quot;</span><span style="font-family: courier new,monospace;">: &quot; +k.getName());</span><br style="font-family: courier new,monospace;">
<div style="font-family: courier new,monospace;" id=":9w">
end</div><br>?<br><br><div class="gmail_quote">2011/10/31 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
If the &quot;donator&quot; isn&#39;t a fact, it&#39;s not visible to the engine. <br><br>Globals are OK on the RHS and as a provider for constant (!) data used as stand-in for literals on the LHS. Other than this: beware! <br>
<font color="#888888">
<br>-W</font><div><div></div><div class="h5"><br><br><br><div class="gmail_quote">2011/10/31 Michael Anstis <span dir="ltr">&lt;<a href="mailto:michael.anstis@gmail.com" target="_blank">michael.anstis@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">
<p>I thought use of the &quot;from&quot; keyword allowed you to reason over facts (potentially) not in WM. I believe the OP&#39;s example is mentioned in the docs?</p>
<p>sent on the move</p><div><div></div><div>
<p>On 31 Oct 2011 15:08, &quot;Wolfgang Laun&quot; &lt;<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>&gt; wrote:<br type="attribution"></p><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">


Globals cannot to be used - directly or indirectly - as objects that should trigger<br>the firing of rules. It is only insert, modify or update, and retract that cause (re-)evaluation of LHS conditions.<br><br>-W <br><br>


<div class="gmail_quote">
On 31 October 2011 15:05, elsdestickere <span dir="ltr">&lt;<a href="mailto:elsdestickere@yahoo.com" target="_blank">elsdestickere@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">



Hi,<br>
<br>
I read docs about global and Hibernate to access your DB from the rules.<br>
I tried something simular for in memory DAO&#39;s.<br>
But some rules fire (&quot;WM&quot; in RHS) as the DAO has 3 items, but others (&quot;dao&quot;<br>
in LHS) don&#39;t, how is that possible?<br>
<br>
global RepositoryFactory repFact;<br>
rule &quot;dao&quot;<br>
    when<br>
       k : Customer(  ) from repFact.getCustomerRepository().findAll();<br>
    then<br>
        System.out.println( &quot;Drools &quot;+drools.getRule().getName()+&quot;: &quot;<br>
+k.getName());<br>
end<br>
rule &quot;WM&quot;<br>
    when<br>
       k : Customer(  ) ;<br>
    then<br>
        System.out.println( &quot;Drools &quot;+drools.getRule().getName()+&quot;: &quot;<br>
+k.getName()+&quot; + size: &quot;+repFact.getCustomerRepository().findAll().size());<br>
end<br>
...<br>
RepositoryFactory repFact = Registry.getRepositoryFactory();<br>
ksession.setGlobal(&quot;repFact&quot;, repFact);<br>
...<br>
CustomerRepository customerRepo = Registry.getRepositoryFactory()<br>
                                .getCustomerRepository();<br>
customerRepo.add(tom);<br>
customerRepo.add(elise);<br>
customerRepo.add(bert);<br>
ksession.insert(bert);<br>
ksession.fireAllRules();<br>
<br>
...<br>
Output:<br>
Drools WM: Bert + size: 3<br>
<br>
br,<br>
Els<br>
<font color="#888888"><br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/global-as-link-to-DB-different-results-tp3467897p3467897.html" target="_blank">http://drools.46999.n3.nabble.com/global-as-link-to-DB-different-results-tp3467897p3467897.html</a><br>




Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br></blockquote>
</div></div><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br></blockquote></div><br>
</div></div><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>
<br></blockquote></div><br>