I have a long time experience working with JBOSS Drools. current project I'm working with uses Drools 4.
here is the one of the rules I have in project
rule "testcase"
salience 300
when
$item : Item(itemTypeId in (Item.ITEM_TYPE_A, Item.ITEM_TYPE_B), targetId < 0)
not Tegret(targetId == $item.targetId)
then
retract ($item);
end
idea is to retract such Items from working memory that does not have associated Target object. I'm testing it with these objects in working memory:
Item {itemId=7305, itemTYpeId=ITEM_TYPE_A, targetId=-1023} Target {targetId = -1023}
in this case rule should not fire, but it does. after lot of experimenting I have found this strange behaviour:
rule "testcase2" fires, while "testcase1" does not.
rule "testcase1"
salience 300
when
$item : Item(itemTypeId in (Item.ITEM_TYPE_A, Item.ITEM_TYPE_B), targetId < 0)
Tegret(targetId == $item.targetId)
then
...
end
rule "testcase2"
salience 300
when
$item : Item(itemTypeId in (Item.ITEM_TYPE_A, Item.ITEM_TYPE_B), targetId < 0)
Tegret($ti:targetId)
eval($ti == $item.targetId)
then
...
end
so what is going wrong here? I'm running "testcase1" and "testcase2" separately on different program runs.