Search in sources :

Example 6 with UserEmailEntity

use of fi.otavanopisto.muikku.model.users.UserEmailEntity in project muikku by otavanopisto.

the class UserEmailEntityDAO method create.

public UserEmailEntity create(UserSchoolDataIdentifier userSchoolDataIdentifier, String address) {
    UserEmailEntity userEmail = new UserEmailEntity();
    userEmail.setUserSchoolDataIdentifier(userSchoolDataIdentifier);
    userEmail.setAddress(address);
    return persist(userEmail);
}
Also used : UserEmailEntity(fi.otavanopisto.muikku.model.users.UserEmailEntity)

Example 7 with UserEmailEntity

use of fi.otavanopisto.muikku.model.users.UserEmailEntity in project muikku by otavanopisto.

the class UserEmailEntityDAO method listByUserSchoolDataIdentifier.

public List<UserEmailEntity> listByUserSchoolDataIdentifier(UserSchoolDataIdentifier userSchoolDataIdentifier) {
    EntityManager entityManager = getEntityManager();
    CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
    CriteriaQuery<UserEmailEntity> criteria = criteriaBuilder.createQuery(UserEmailEntity.class);
    Root<UserEmailEntity> root = criteria.from(UserEmailEntity.class);
    criteria.select(root);
    criteria.where(criteriaBuilder.equal(root.get(UserEmailEntity_.userSchoolDataIdentifier), userSchoolDataIdentifier));
    return entityManager.createQuery(criteria).getResultList();
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) EntityManager(javax.persistence.EntityManager) UserEmailEntity(fi.otavanopisto.muikku.model.users.UserEmailEntity)

Aggregations

UserEmailEntity (fi.otavanopisto.muikku.model.users.UserEmailEntity)7 EntityManager (javax.persistence.EntityManager)3 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)3 UserEntity (fi.otavanopisto.muikku.model.users.UserEntity)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1