dsergiu77
unread,Feb 10, 2012, 5:21:31 AM2/10/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nhusers
Hi,
I need to get an overview of the tasks still open for a given
employee.
For this I call a named query which contains an SQL statement and
transform the results in a dto object:
It works fine If I get the results of the query directly:
var empOverviewList = Session.GetNamedQuery("THOForEmployee")
.SetInt32("EmployeeId", employeeId)
.SetResultTransformer(Transformers.AliasToBean<TaskHeaderOverview>())
.List<TaskHeaderOverview>();
But if I try to delay the query call using Future<>() and iterate over
the result, then the dto's fields all contain empty values. It looks
like the values were not assigned or were asigned too early, before
the query was run.
var empOverviewList = Session.GetNamedQuery("THOForEmployee")
.SetInt32("EmployeeId", employeeId)
.SetResultTransformer(Transformers.AliasToBean<TaskHeaderOverview>())
.Future<TaskHeaderOverview>();
foreach(TaskHeaderOverview item in empOverviewList)
{
// item has all fields "empty"
}
Do you know of any issue with this combination?
Thanks and regards,
Sergiu Dauceanu.