title: Hibernate issue on creation OnetoMany,ManyToOne Mapping Giving null
body: <p>I have a model like this:</p>
  
  <pre><code>@Entity
  [...]
  class ParentObject{
      [...]
      @OneToMany(cascade = CascadeType.ALL, mappedBy= "parentObject", orphanRemoval = true)
      private List&lt;Relationship&gt; relationship;
  }
  </code></pre>
  
  <p>and in Relationship entity:</p>
  
  <pre><code>@ManyToOne
  @JoinColumn(name="PARENT_OBJECT_ID")
  private ParentObject parentObject;
  </code></pre>
  
  <p>and everything works fine on update and save. Only when I try to create a new ParentObject with new Relationships inside it:</p>
  
  <pre><code>parentObject: { 
    id: null, 
    relationship: [ 
        {id:null,
        parentObjectId:null,
        [...]
    }] 
  }
  </code></pre>
  
  <p>hibernate doesn't have an id for the ParentObject, so Relationship.parentObject.id is null. Database throws an error saying: </p>
  
  <blockquote>
    <p>cannot insert NULL into ("MYDB"."RELATIONSHIP"."PARENT_OBJECT_ID")</p>
  </blockquote>
  
  <p>Any help would be appreciated.</p>
  
  <p><strong>Edit:</strong> Here's my service code:</p>
  
  <pre><code>public ParentObjectDto save(ParentObjectDto parentObjectDto) {
  ParentObject parentObject = dtoConverter.convert(parentObjectDto, ParentObject.class);      
  
  boolean isNewPO = parentObject.getId() == null ? true : false;
  
  parentObject = parentObjectRepository.save(parentObject);
  
  if (isNewPO) {
      // This loop ensures that when a new PO is added, the child relationship
      // objects are connected with the new parentObject that was just added.
      for (Relationship relationship : parentObject.getRelationship()) {
          relationship.setParentObject(parentObject);
      }
  }
  
  return dtoConverter.convert(parentObject, ParentObjectDto.class);
  </code></pre>
  
  <p>}</p>
  
  <p>the names of course aren't the ones I write here, I just changed them to be more understandable, if I have any spelling mistakes it's from my manual changes :)</p>