hibernate distinct query
I have a query, with many joins, executed by hibernate. This query contains many joins. Only some values from the database must be retrieved, and there can be several conditions in the where clause.
Now the thing is that the same result is returned many times. So I used the DistinctRootEntityResultTransformer, unfortunately the result is still the same. I have written my code below. What is wrong with my implementation or is there another way?
sql += "a large query with many joins";
SQLQuery query = getSession().createSQLQuery(sql);
List<Object> list = DistinctRootEntityResultTransformer.INSTANCE.trans formList(query.list());
thanks for any help
Can't you use "select distinct <className>.<thing I'm interested in>..."?
Sometimes I can make it so difficult while it's so easy.
it indeed did the trick