hi,
hibernate 3.0
sql server 2k
windows 2k3s, jdk 1.4.2_05
i'm using criteria to build my queries and it was working great until i did an "in" Restriction on a mapped Set and started getting dupes. From this, I decided to add a distinct Projection. When I did that, I got this query, which looks correct:
select distinct this_.content_id as y0_ from iwsc_content this_ left outer join iwsc_news this_1_ on this_.content_id=this_1_.content_id left outer join iwsc_event this_2_ on this_.content_id=this_2_.content_id left outer join iwsc_document this_3_ on this_.content_id=this_3_.content_id inner join iwsc_content_category categories3_ on this_.content_id=categories3_.content_id inner join iwsc_category category1_ on categories3_.category_id=category1_.category_id where (
this_.expiration_date is null or this_.expiration_date>?) and category1_.category_id in (?, ?, ?, ?) and this_.branch in (?) order by this_.creation_date desc
and got this from SQL SERVER:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
i'm also using hibernate to paginate and sort, so this could be a big problem... any help is greatly appreciated!
thanks,
shanon
|