0

I have the following hql query which I'd like to switch over to the criteria API

select a.Id as Id, a.Name as Name, a.ActiveStatus as ActiveStatus, 
dbo.GetActivityStartDate(a.Id) as StartDate, 
dbo.GetActivityEndDate(a.Id) as EndDate, 
coalesce(ac.Id,0) As CategoryId, 
coalesce(ac.Name,'') As CategoryName 
from Activity as a 
left outer join a.Category as ac 

Obviously the initial properties on the select line are trivial (Projections.Property); my question is..how do I map the remaining 4 properties?

I have a custom dialect that registers dbo.GetActivityStartDate and dbo.GetActivityEndDate as standard SQL functions - so that much is already taken care of.

4

1 回答 1

0

所以......原来我需要用我的自定义方言注册“ISNULL”功能;一旦我这样做了,使用 Projections.SqlFunction 以我需要的格式提取数据就很简单了。

于 2010-07-20T14:25:42.190 回答