Search in sources :

Example 11 with CourseStaffMember

use of fi.otavanopisto.pyramus.domainmodel.courses.CourseStaffMember in project pyramus by otavanopisto.

the class CourseStaffMemberDAO method findByCourseAndStaffMember.

public CourseStaffMember findByCourseAndStaffMember(Course course, StaffMember staffMember) {
    EntityManager entityManager = getEntityManager();
    CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
    CriteriaQuery<CourseStaffMember> criteria = criteriaBuilder.createQuery(CourseStaffMember.class);
    Root<CourseStaffMember> root = criteria.from(CourseStaffMember.class);
    criteria.select(root);
    criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(CourseStaffMember_.course), course), criteriaBuilder.equal(root.get(CourseStaffMember_.staffMember), staffMember)));
    return getSingleResult(entityManager.createQuery(criteria));
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) EntityManager(javax.persistence.EntityManager) CourseStaffMember(fi.otavanopisto.pyramus.domainmodel.courses.CourseStaffMember)

Aggregations

CourseStaffMember (fi.otavanopisto.pyramus.domainmodel.courses.CourseStaffMember)11 Course (fi.otavanopisto.pyramus.domainmodel.courses.Course)6 StaffMember (fi.otavanopisto.pyramus.domainmodel.users.StaffMember)6 CourseStudent (fi.otavanopisto.pyramus.domainmodel.courses.CourseStudent)5 CourseDAO (fi.otavanopisto.pyramus.dao.courses.CourseDAO)4 CourseStaffMemberDAO (fi.otavanopisto.pyramus.dao.courses.CourseStaffMemberDAO)4 HashMap (java.util.HashMap)4 CourseComponentDAO (fi.otavanopisto.pyramus.dao.courses.CourseComponentDAO)3 CourseDescriptionDAO (fi.otavanopisto.pyramus.dao.courses.CourseDescriptionDAO)3 CourseStaffMemberRoleDAO (fi.otavanopisto.pyramus.dao.courses.CourseStaffMemberRoleDAO)3 CourseStudentDAO (fi.otavanopisto.pyramus.dao.courses.CourseStudentDAO)3 StaffMemberDAO (fi.otavanopisto.pyramus.dao.users.StaffMemberDAO)3 CourseEducationSubtype (fi.otavanopisto.pyramus.domainmodel.base.CourseEducationSubtype)3 CourseEducationType (fi.otavanopisto.pyramus.domainmodel.base.CourseEducationType)3 EducationSubtype (fi.otavanopisto.pyramus.domainmodel.base.EducationSubtype)3 EducationType (fi.otavanopisto.pyramus.domainmodel.base.EducationType)3 EducationalTimeUnit (fi.otavanopisto.pyramus.domainmodel.base.EducationalTimeUnit)3 Organization (fi.otavanopisto.pyramus.domainmodel.base.Organization)3 Subject (fi.otavanopisto.pyramus.domainmodel.base.Subject)3 Tag (fi.otavanopisto.pyramus.domainmodel.base.Tag)3