AnsweredAssumed Answered

How get task from business key

Question asked by aram on Apr 16, 2012
Latest reply on Apr 17, 2012 by aram
I am using grails activity plugin. and I like to get all tasks for current document.
to do that I define domain classes "Task" and "Execution" in grains and use following HQL

getTaskForDocument = from Task
where id in(
select id from Task where EXECUTION_ID_ in(
select from Execution exec1 where
exec1.BUSINESS_KEY_=:BUSINESS_KEY and in( select max(id) from Execution as exec2 where exec2.BUSINESS_KEY_ = exec1.BUSINESS_KEY_ )))

List tasksForDocument = Task.findAll(getTaskForDocument, [BUSINESS_KEY: "BUSINESS_KEY_here"]);

Is there any other effective way to get Task using BUSINESS_KEY (I don't like to have/define  "Task" and "Execution" domain classes in my app)?