title: Spring crud repository - save() tries to insert new rows for many-to-one relationship in child property
body: <p>Spring crud repository save() method performs Insert operation if ID is null, otherwise it performs an Update operation. I have the following Entity beans -</p>
  
  <pre><code>Student {
   @Id integer studentId;
   ....
   @OneToMany Set&lt;Project&gt; projects;
   @OneToMany Set&lt;Subject&gt; subjects;
  }
  
  Project {
   @Id integer projectId;
   ....
   @ManyToOne Student student;
  }
  
  Subject {
   @Id integer subjectId;
   ....
   @ManyToOne Student student;
  }
  </code></pre>
  
  <p>If I use spring crud repository to perform save() operation on one instance of Project p, it tries to perform insert on all the Subject that p.student has already been associated. And as a result, I get a primary key constraint violation error.</p>
  
  <p>Spring jpa should only insert the Project and not the entire tree of Student and it's set of subjects.</p>
  
  <p>Is there any way to do this ?</p>