use of javax.persistence.NonUniqueResultException in project Asqatasun by Asqatasun.
the class OptionElementDAOImpl method findOptionElementFromUserAndFamilyCode.
@Override
public Collection<OptionElement> findOptionElementFromUserAndFamilyCode(User user, String optionFamilyCode) {
Query query = entityManager.createQuery("SELECT distinct(u.optionElementSet) FROM " + getUserEntityClass().getName() + " u" + " LEFT JOIN u.optionElementSet oe" + " WHERE u=:user" + " AND oe.option.optionFamily.code=:optionFamilyCode");
query.setParameter("user", user);
query.setParameter("optionFamilyCode", optionFamilyCode);
try {
return (Collection<OptionElement>) query.getResultList();
} catch (NoResultException | NonUniqueResultException nre) {
return null;
}
}
Aggregations