title: JPA Hibernate @OneToMany fails to insert children
body: <p>I have an entity called &quot;Review&quot; that has a <code>@OneToMany</code> relationship with a <code>ReviewStage</code> entity.  Very simple in my mind.</p>
  <p>My database looks like this:</p>
  <p><code>Review</code> table:</p>
  <ul>
  <li>review_id</li>
  <li>name</li>
  </ul>
  <p><code>Stage</code> table:</p>
  <ul>
  <li>stage_id</li>
  <li>review_id</li>
  <li>name</li>
  </ul>
  <p><code>Review</code> Entity:</p>
  <pre><code>@Entity
  @Getter @Setter @NoArgsConstructor
  public class Review {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long reviewId;
      private String name;
   
      @OneToMany(cascade = CascadeType.ALL, mappedBy = &quot;reviewId&quot;, fetch=FetchType.EAGER)
      private Set&lt;ReviewStage&gt; stages;
  }
  </code></pre>
  <p><code>ReviewStage</code> Entity:</p>
  <pre><code>@Entity
  @Getter @Setter @NoArgsConstructor
  public class ReviewStage {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long stageId;
      private Long reviewId;
      private String name;
  }
  </code></pre>
  <p>I post the following JSON to my Service:</p>
  <pre><code>{
      &quot;reviewId&quot;: 0,
      &quot;name&quot;: &quot;TEST&quot;,
      &quot;stages&quot;: [{
          &quot;stageId&quot;: 0,
          &quot;reviewId&quot;: 0,
          &quot;name&quot;: &quot;Stage 1&quot;
      }]
  }
  </code></pre>
  <blockquote>
  <p>JDBC Error: com.microsoft.sqlserver.jdbc.SQLServerException: The
  INSERT statement conflicted with the FOREIGN KEY constraint
  &quot;FK_er_review_stage_er_review&quot;. The conflict occurred in database
  &quot;ereviewdev&quot;, table &quot;dbo.review&quot;, column 'review_id'.</p>
  </blockquote>
  <p>What am I missing? I tried to put <code>@Transactional</code> in my Service class but, it didn't have any affect. Seems simple.</p>