2

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

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?

UpTheCreek
  • 31,444
  • 34
  • 152
  • 221

1 Answers1

3

Ah, it looks like this works:

select distinct new SomeClass(i.Id, i.Name) from Item i...
UpTheCreek
  • 31,444
  • 34
  • 152
  • 221