tkobayas commented on issue #6529:
URL:
https://github.com/apache/incubator-kie-drools/issues/6529#issuecomment-3584356831
Workarounds until 10.2.0 will be released:
- Use non-RuleUnit / non-executable-model : The issue happens only with
executable-model (regardless of RuleUnit). So the workaround is to use
non-executable-model, which means to use the the traditional DRL without
RuleUnit and configures the dependency `drools-engine-classic`. The doc says
`drools-engine-classic` is deprecated, but it still works and can be a
workaround until 10.2.0 will be released.
- Avoid `exists XXX from` : The bug is related to `exists XXX from`. It
doesn't mean that `exists XXX from always` causes the issue, but if you replace
`exists XXX from` with a different expression, the issue would disappear.
For example)
```
import static com.model.Utils.hasChildOlderThan;
rule "Rule 2"
when
House() from entry-point houses
$person: Person() from entry-point people
//exists Child(age > 18) from $person.children
eval(hasChildOlderThan($person, 18))
not School() from entry-point schools
then
rulesFired.add("rule2");
end
```
```
public class Utils {
public static boolean hasChildOlderThan(Person person, int age) {
return person.getChildren().stream().anyMatch(a -> a.getAge() > age);
}
}
```
If you are migrating from old drools version, probably the first option
(non-executable-model) is easier. Traditional DRL is still fully supported, so
you are not forced to use RuleUnit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]