Skip to content

Commit

Permalink
Fixed - editCourse
Browse files Browse the repository at this point in the history
  • Loading branch information
MatiasComercio committed Jun 15, 2016
1 parent 36c8a24 commit 699e63a
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ public boolean update(int id, Course course){

//NOTE: In this case if the id is changed an exception is thrown. In the future we shouldn't allow a user to modify the seq_id!
final List<Course> correlatives = getCorrelativeCourses(id);
final List<Course> upperCorrelatives = getCorrelativeCourses(id);

final Set<Course> setCorrelatives = new HashSet<>(correlatives);
final Set<Course> setUpperCorrelatives = new HashSet<>(upperCorrelatives);

course.setCorrelatives(setCorrelatives);
course.setUpperCorrelatives(setUpperCorrelatives);

Session session = em.unwrap(Session.class);
Course oldCourse = em.getReference(Course.class, id);

course.setUpperCorrelatives(oldCourse.getUpperCorrelatives());

em.detach(oldCourse);
session.update(course);

Expand Down

0 comments on commit 699e63a

Please sign in to comment.