public GroupCourses createGroupCourses(String title, String url, Section section) { GroupCourses groupCourses = new GroupCourses(); groupCourses.setTitle(title); groupCourses.setSection(section); groupCourses.setUrl(url); groupCourses.setCreateDate(Calendar.getInstance()); create(groupCourses); return groupCourses; }
@Override public GroupCourses prepare(GroupCourses entity, User currentUser, List<ViewType> viewTypes) { Long coursesCount = (Long) entityManager .createQuery( "select count(c) from Course c where c.groupCourses.id = :groupCoursesId") .setParameter("groupCoursesId", entity.getId()) .getSingleResult(); entity.setCoursesCount(coursesCount); return super.prepare(entity, currentUser, viewTypes); }