select distinct ti.processInstance from TaskInstance ti where ti.processInstance.end is null and ti.actorId= :actorId and ti.isOpen=false order by ti.processInstance.id desc
taskInstance 和processInstance 是model。
processInstance has-many taskInstance 。