Hi All,
I'm trying to improve performance of the CMP part of my application.
I need to just count the number of "ToDoTask" with the severity property set to 'Error' and which are generated by an "IntegrityRule".
For this, I wrote this code in the IntegrityRuleEJBBean:
/**
* @ejb.interface-method view-type = "both"
*/
public int countErrorTasks(){
try {
return ejbSelectCountErrorTasks(this.getId());
} catch (FinderException e) {
return 0;
}
}
/**
* @ejb.select query="SELECT COUNT(t) FROM IntegrityRule r, IN(r.tasks) t WHERE t.severity='Error' and r.id=?1"
* @ejb.interface-method view-type = "both"
*/
public abstract int ejbSelectCountErrorTasks(Long ruleId) throws FinderException;
As you can see, the "countErrorTasks" method is just a wrapper method to mask the getId() call.
How can I build by the select query to use directly the id of the current IntegrityRule? Because the ejbSelect runs "out of" the bean instance...
Any help would be appreciated....
Alban.