title: delete detail from database using spring-data-jpa
body: <p>Now I am using spring-data-jpa &amp; hibernate. I want to delete a courseDetail from the course, But after I run my code below the courseDetail is still in the database.</p>
  
  <p>Who can tell me how this happened?</p>
  
  <p>thanks in advance.</p>
  
  <pre><code>@Transactional(readOnly = false)
  public void deleteCourseDetail(Long id, Long courseId) {
      Course course = courseDao.findOne(courseId);
      CourseDetail courseDetail = courseDetailDao.findOne(id);
      System.out.println(course.getCourseDetails().size());
      course.getCourseDetails().remove(courseDetail);
      System.out.println("after: " + course.getCourseDetails().size());
      courseDao.save(course);
  }
  
  @OneToMany(mappedBy = "course", fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
  public List&lt;CourseDetail&gt; getCourseDetails() {
      return courseDetails;
  }
  </code></pre>
  
  <p>Now it works after I add courseDetailDao.delete(id); behind save method. but WHY?</p>