<div dir="ltr"><br> It is fine to do that.<br> <br><br><div class="gmail_quote">2008/10/13 Michal Bali <span dir="ltr"><<a href="mailto:michalbali@gmail.com">michalbali@gmail.com</a>></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'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> int someProperty;<br>
<br> public int getSomeProperty() {<br> return someProperty;<br> }<br> public void setSomeProperty(int someProperty) {<br> this.someProperty = someProperty;<br> }<br><br> @Override<br> public boolean equals(final Object other) {<br>
if (this == other)<br> return true;<br> if (!(other instanceof BeanA))<br> return false;<br> BeanA castOther = (BeanA) other;<br> return new EqualsBuilder().append(someProperty,<br> castOther.someProperty).isEquals();<br>
}<br><br> @Override<br> public int hashCode() {<br> return new HashCodeBuilder(228431015, 1383549405).append(<br> someProperty).toHashCode();<br> } <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> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>