eranhauser wrote:
Hi,
I am using Hibernate 3. I have a complex query that looks like that:
select setting from Device device inner join device.supportedSettings setting inner join setting.settingType type where
device.manufacturer = 2 and type = 1 order by setting.name"
The problem is that I am getting duplicate results. I put the distinct (select distinct setting from…). However I get an exception “ORDER BY item should be in the SELECT DISTINCT list”. What can I do?
I used to get thi error which is actually a SQL thing. Just put setting.name in the select clause alongwith distinct so you query would be
Code:
select distinct setting, setting.name .......
Hope it helps.