This question is in continuation to an earlier question here so my data structure is as earlier :
public class Premium{
private List<InsuranceType> insuranceTypes;
// getter and setter
}
public class InsuranceType {
private String name;
private String category;
// getter and setter
}
And here is my rule thanks to @RoddyoftheFrozenPeas
rule "Example"
when
$pcr:Premium( $insuranceTypes: insuranceTypes )
$ins:( InsuranceType( name == "TPD" , category == "D" ) from $insuranceTypes )
then
modify( $ins ){
setCategory("A");
}
end
However when running this rule get an exception:
java.lang.RuntimeException: Update error: handle not found for object: InsuranceType [name=TPD, category=A]. Is it in the working memory?
Is this occurring because I am checking for the same attribute and also updating it ? My use case is to replace the value so I have to check for its presence ( category = D and then set it to 'A' )