NHibernate HQL: how to use the new constructor of objects with "excellent"?

I need to use the HQL constructor constructor , for example:

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

But I also have to use the keyword , as there is another connection in the request, for example: distinct

select distinct i.Id from Item i

I tried this: but it just throws an Antlr exception, so I assume its invalid syntax is:

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

Is it possible?

+2
source share
1 answer

And it looks like this works:

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

Source: https://habr.com/ru/post/1724875/


All Articles