public void update(Instructor instructor, List<Long> ids) { List<Course> courses = this.courseDao.getByIds(ids); Set<Course> coursesSet = new HashSet<>(courses); instructor.setCourses(coursesSet); this.update(instructor); }
@Override public Long create(Instructor instructor) { instructor.setPassword(this.passwordEncoder.encode(instructor.getPassword())); return super.create(instructor); }
public void create(Instructor instructor, List<Long> ids) { List<Course> courses = this.courseDao.getByIds(ids); instructor.getCourses().addAll(courses); this.instructorDao.create(instructor); }