Archive for July, 2008
When using joins(outer join fetch or join fetch) in HQL or when using Criteria… you may end up having duplicate objects in your result list. The way is simple to filter the results. Simply use a HashSet or LinkedHashSet or TreeSet
Example:
List list = session.session.getNamedQuery(“My.Named.Query.With.Joins”).list();
// you might have duplicates now
Set set = new HashSet(list);
list.clear();
list.addAll(set);
// no duplicates [...]
Filed under: Hibernate, Technical | 2 Comments
Tags: duplicate objects, duplicate results, hibernate, hql
Search
-
You are currently browsing the Sanchit Srivastava weblog archives for the month July, 2008.