Beginner |
|
Joined: Tue May 23, 2006 4:10 pm Posts: 38 Location: Charleston, SC
|
I had the very same problem and have found a couple of ways to solve it. If you expect the result to be unique, use uniqueResult. I have personally observed distinct return dups when I joined more than two tables; it worked well when I joined two tables. The best solution seems to be code like the following:
List resultsWithDups = query.list();
Set resultSet = new HashSet(resultsWithDups);
The set doesn't allows dups so it effectively filters the list using the object's equals method.
Grant
|
|