Is there any possible way to avoid looping without using NO-LOOP attribute of Drools(Like I have heard we can achieve this by using the not(!) operator on objects but am unable to find out.)
The problem is NO-LOOP attribute can't be used(as that is the requirement) so refer to the rule below and tell is it possible to avoid looping.
TestClass.java
public class TestClass{
private String name;
private int age;
// Few other variables
// their getters and setters
}
Rules
rule "abc"
when
$obj : TestClass(name=="test", age != 20)
then
TestClass $obj2 = new TestClass();
$obj2.setName("test");
$obj2.setAge(30);
insert($obj2);
end