开发者

NHibernate HQL: How to use the new object constructor with 'distinct'?

I need to use the HQL object constructor feature, e.g:

select new SomeClass(i.Id, i.Name) from Item i...

But I also need to use the distinct keyword, as there are joins further down in the query, e.g.:

select distinct i.Id from Item i
开发者_C百科

I have tried this: but it just causes an Antlr exception, so I assume it's invalid syntax:

select new SomeClass(distinct i.Id, i.Name) from Item i

Is this possible?


Ah, it looks like this works:

select distinct new SomeClass(i.Id, i.Name) from Item i...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜