It is fine to do that.
2008/10/13 Michal Bali <michalbali(a)gmail.com>
Hello,
Let's say we have a simple BeanA with one property that is part of
equal/hashCode method e.g.:
----------------------------------------
public class BeanA {
int someProperty;
public int getSomeProperty() {
return someProperty;
}
public void setSomeProperty(int someProperty) {
this.someProperty = someProperty;
}
@Override
public boolean equals(final Object other) {
if (this == other)
return true;
if (!(other instanceof BeanA))
return false;
BeanA castOther = (BeanA) other;
return new EqualsBuilder().append(someProperty,
castOther.someProperty).isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(228431015, 1383549405).append(
someProperty).toHashCode();
}
}
------------------------------------
This bean is inserted into the working memory. Is it something wrong with
doing?:
wm.modifyRetract(beanA);
beanA.setSomeProperty(22); //this is changing the object equality key
wm.modifyInsert(beanAHandle, beanA);
I know that simple update is not allowed:
beanA.SetSomeProperty(22);
update(beanAHandle, beanA); //this is wrong
I guess there is no difference if this code is outside the rule engine or
inside (e.g. in a rule consequence).
Thank you,
Best Regards,
Michal
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @
www.jboss.com