Ingomar Otter wrote:
I would be intrested in the "how does Drools manage its
knowledge of
changes to Collections embedded in fact objects" question as well.
That caused some headache earlier this year we never got to the bottom
of the behaviour and in the end worked around it in not-so-elegant ways.
The
correct way, imho, is to insert each of the child elements of the
collection and use an additional class to represent the relationship so
you can query. Simply put drools is not aware of changes to a nested
field, unless it's inserted, and if it's inserted you'll need to express
it's link to the parent object via a relation instance.
Mark
Am 20.04.2009 um 18:31 schrieb Bagwell, Allen F:
>
> This is in Drools 4.0.7
>
> I have a class called SatManager with a field:
>
> ArrayList<Satellite> listOfOverheadSats
>
> That has an appropriate getter method.
>
> I have a relatively simple rule that goes something like this:
>
> when
> $sat : Satellite(isOverhead == true)
> $sm : SatManager($ls : listOfOverheadSats not contains $sat)
> then
> $ls.add($sat);
>
> My problem is that Drools doesn't understand that the ArrayList has
> been modified, therefore this rule always fires on the same satellite
> if the sat object changes in any other way.
>
> I've tried adding:
>
> update($sm);
>
> To the consequence, but that only caused the rule to re-fire
> infinitely -- even with the no-loop keyword applied.
>
> So my question is how does Drools manage its knowledge of changes to
> Collections embedded in fact objects? The documention for the
> 'contains/not contains' keyword did not explain this.
>
> I'm really stumped here.
>
> Allen F. Bagwell
> e-mail: afbagwe(a)sandia.gov
> phone: 505/284-4517
> fax: 505/ 844-7886
>
>
> Ask your doctor if medical advice from a TV commercial is right for you.
>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users