It seems that when a task is created and has potential owners the actualOwner and creator are set to null. This leads to the problem detailed here http://community.jboss.org/message/621095# for fnding the tasks by potential owners.
So, I have a task where "mary" is a potential owner by being a member of a group. Using the updated Named Query from the other discussion I am able to find the task and assign it to mary using the Mina Task Service. This has the effect of setting the actualOwner of the task to mary as expected. However the task is not being found when executing the Named Query "TasksOwned". I think it is because createdBy on the task is not being set and the query assumes it has some value.
I think I can fix this by changing the query, however, I'm concerned that there does not seem to be a logical way that createdBy is being set. Why have a createdBy field on a task if it is only set when the owner is known at creation time? And if it cannot be relied upon to be there then should any of the queries include it?
I will provide the updated query when I get it working properly.