I have problems in add instances to list in RHS of rule.
There're two classes shown as below:
class Person {
private java.lang.Integer age;
private java.lang.String name;
}
class A {
private java.util.List<Person> persons;
private java.util.List<Person> selectedPersons;
}
In the following rule, I want to put person with age larger than 30 into selectedPersons.
rule "test"
when
$a:A()
$p : Person(age > 30) from $a.persons
then
$a.getSelectedPersons().add($p);
end
It works in eclipse, with Drools plugin; but it doesn't after deploying to KIE server. What I get is the instance reference only. Any ideas?
Also, I wonder why KIE server throw java.lang.NoSuchMethodError Exception when I add following constructor to Person class, while workbench can build and deploy the rule successfully:
public Person(Person p)
{
this.name = p.name;
this.age = p.age;
}
<selectedPersons> <Person reference="../../selectedPersons/Person"/> </selectedPersons>
, but noname
orage
– dehiker