title: Spring Data JPA One to Many relationship not saving child table
body: <p>Parent Entity</p>
  
  <pre><code>@OneToMany(fetch = FetchType.EAGER, mappedBy = "paramRef", cascade=CascadeType.ALL)
  public Set getParamList() { return this.paramList; }
  </code></pre>
  
  <p>Child Entity</p>
  
  <pre><code>@ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "param_Ref_Id", nullable = false, insertable=false, updatable=false)
  public ParamRef1 getParamRef() { return this.paramRef; }
  </code></pre>
  
  <p>Code to persist</p>
  
  <pre><code>ParamRef1 pr = new ParamRef1();
  pr.setName("TEST PARAM");
  
  Param1 p1 = new Param1() p1.setParamValue("ONE") p1.setParamRef(pr);
  Param1 p2 = new Param1() p2.setParamValue("TWO") p2.setParamRef(pr);
  
  Set paramList = new HashSet() paramList.add(p1) paramList.add(p2)
  
  pr.setParamList(paramList)
  
  pr = paramRefDao1.save(pr)
  </code></pre>
  
  <p>Please let me know if the steps are correct. I am getting following exception. and not able to understand why parent id is not available in child table</p>
  
  <blockquote>
    <p>Caused by: org.hibernate.exception.ConstraintViolationException:
    Cannot insert the value NULL into column 'PARAM_REF_ID', table
    'PARAM'; column does not allow nulls. INSERT fails.</p>
  </blockquote>