use of fi.otavanopisto.muikku.model.users.UserGroupUserEntity in project muikku by otavanopisto.
the class UserGroupUserEntityDAO method findByDataSourceAndIdentifierAndArchived.
public UserGroupUserEntity findByDataSourceAndIdentifierAndArchived(SchoolDataSource schoolDataSource, String identifier, Boolean archived) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<UserGroupUserEntity> criteria = criteriaBuilder.createQuery(UserGroupUserEntity.class);
Root<UserGroupUserEntity> root = criteria.from(UserGroupUserEntity.class);
criteria.select(root);
criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(UserGroupUserEntity_.archived), archived), criteriaBuilder.equal(root.get(UserGroupUserEntity_.schoolDataSource), schoolDataSource), criteriaBuilder.equal(root.get(UserGroupUserEntity_.identifier), identifier)));
return getSingleResult(entityManager.createQuery(criteria));
}
use of fi.otavanopisto.muikku.model.users.UserGroupUserEntity in project muikku by otavanopisto.
the class UserGroupUserEntityDAO method listByUserSchoolDataIdentifier.
public List<UserGroupUserEntity> listByUserSchoolDataIdentifier(UserSchoolDataIdentifier userSchoolDataIdentifier) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<UserGroupUserEntity> criteria = criteriaBuilder.createQuery(UserGroupUserEntity.class);
Root<UserGroupUserEntity> root = criteria.from(UserGroupUserEntity.class);
criteria.select(root);
criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(UserGroupUserEntity_.userSchoolDataIdentifier), userSchoolDataIdentifier)));
return entityManager.createQuery(criteria).getResultList();
}
Aggregations