use of fi.otavanopisto.muikku.model.users.UserEntityProperty in project muikku by otavanopisto.
the class UserEntityPropertyDAO method findByUserEntityAndKey.
public UserEntityProperty findByUserEntityAndKey(UserEntity userEntity, String key) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<UserEntityProperty> criteria = criteriaBuilder.createQuery(UserEntityProperty.class);
Root<UserEntityProperty> root = criteria.from(UserEntityProperty.class);
criteria.select(root);
criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(UserEntityProperty_.userEntity), userEntity), criteriaBuilder.equal(root.get(UserEntityProperty_.key), key)));
return getSingleResult(entityManager.createQuery(criteria));
}
Aggregations