<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>