use distinct for joins and fetches over one to many relationships

This commit is contained in:
Athou
2013-06-05 13:42:00 +02:00
parent e9bd8f81ee
commit f7b10cb6c6
2 changed files with 7 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ public class UserRoleDAO extends GenericDAO<UserRole> {
public List<UserRole> findAll() {
EasyCriteria<UserRole> criteria = EasyCriteriaFactory
.createQueryCriteria(em, getType());
criteria.setDistinctTrue();
criteria.leftJoinFetch(UserRole_.user.getName());
return criteria.getResultList();
}