This is the state of things in connection with hashCode, update and object comparison:<br><br><ul><li>There is a fact type A with a field b of class B and</li><li>patterns for A use constraints comparing b with "==" to some other object of type B and<br>
</li><li>B overrides hashCode using a field c of B and</li><li>this field is changed in an update of some object B.</li></ul>In any situation like this, it is necessary to instruct the engine
that any fact of type A containing a reference to the changed fact B
has changed.<br><br>In most real-world situation, this may not be possible. Then, <br>
<ul><li>either avoid constraining on object references by replacing this with primary key field constraints,</li><li>or refrain from using c in hashCode.</li></ul>-W<br><br><br><div class="gmail_quote">On 22 June 2011 13:58, M. H. <span dir="ltr"><<a href="mailto:hugues_81@hotmail.com">hugues_81@hotmail.com</a>></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;">And yet the funny thing is it does affect the other fact:<br>
if you run this without the hashCode and equals method, it works fine, but<br>
if you run it with hashCode and equals overriden, the second rule won't be<br>
executed.<br>
You mentionned before the usual rules for hashCode and equals, what are they<br>
appart from equals=>equal hashCodes? I don't understand why this works in a<br>
case and not in the other, so maybe I'm missing something here?<br>
<br>
Thanks,<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/rules-users-Drools-use-of-hashCode-tp3090455p3095159.html" target="_blank">http://drools.46999.n3.nabble.com/rules-users-Drools-use-of-hashCode-tp3090455p3095159.html</a><br>
</font><div><div></div><div class="h5">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">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>
</div></div></blockquote></div><br>