<div dir="ltr"><br>&nbsp;&nbsp; It is fine to do that.<br>&nbsp;&nbsp; <br><br><div class="gmail_quote">2008/10/13 Michal Bali <span dir="ltr">&lt;<a href="mailto:michalbali@gmail.com">michalbali@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;">
<div dir="ltr">Hello,<br><br>Let&#39;s say we have a simple BeanA with one property that is part of equal/hashCode method e.g.:<br>----------------------------------------<br>public class BeanA {<br>&nbsp; int someProperty;<br>

<br>&nbsp; public int getSomeProperty() {<br>&nbsp;&nbsp;&nbsp; return someProperty;<br>&nbsp; }<br>&nbsp; public void setSomeProperty(int someProperty) {<br>&nbsp;&nbsp;&nbsp; this.someProperty = someProperty;<br>&nbsp; }<br><br>&nbsp; @Override<br>&nbsp; public boolean equals(final Object other) {<br>

&nbsp;&nbsp;&nbsp; if (this == other)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return true;<br>&nbsp;&nbsp;&nbsp; if (!(other instanceof BeanA))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;<br>&nbsp;&nbsp;&nbsp; BeanA castOther = (BeanA) other;<br>&nbsp;&nbsp;&nbsp; return new EqualsBuilder().append(someProperty,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; castOther.someProperty).isEquals();<br>

&nbsp; }<br><br>&nbsp; @Override<br>&nbsp; public int hashCode() {<br>&nbsp;&nbsp;&nbsp; return new HashCodeBuilder(228431015, 1383549405).append(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; someProperty).toHashCode();<br>&nbsp; }&nbsp; <br>}<br>------------------------------------<br>This bean is inserted into the working memory. Is it something wrong with doing?:<br>

wm.modifyRetract(beanA);<br>beanA.setSomeProperty(22); //this is changing the object equality key<br>wm.modifyInsert(beanAHandle, beanA);<br><br>I know that simple update is not allowed:<br>beanA.SetSomeProperty(22);<br>
update(beanAHandle, beanA); //this is wrong<br>
<br>I guess there is no difference if this code is outside the rule engine or inside (e.g. in a rule consequence).<br><br>Thank you,<br>Best Regards,<br>Michal<br><br></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><br clear="all"><br>-- <br> &nbsp;Edson Tirelli<br> &nbsp;JBoss Drools Core Development<br> &nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>