title: Hibernate tries to persist child twice after setting parent
body: <p>I've got such Hibernate mapping:</p>
  
  <p>Parent:</p>
  
  <pre><code>@OneToMany(mappedBy = "parent")
  @Valid
  private Set&lt;Assignment&gt; assignments;
  </code></pre>
  
  <p>Child:</p>
  
  <pre><code>@ManyToOne(cascade = {CascadeType.PERSIST})
  @JoinColumn(name = "parent_id")
  @Valid
  private Parent parent;
  </code></pre>
  
  <p>I've got such situation: Parent is already persisted in database, I get new Assignments list. I make such thing (using Spring Data JPA):</p>
  
  <pre><code>parent.getAssignments().addAll(newAssignments);
  parent.getAssignments().forEach(assignment -&gt; assignment.setParent(parent));
  parentRepository.save(parent);
  </code></pre>
  
  <p>I've got @PrePersist annotated method in base entity (extended by both), with validation that checks if createdDate, which is initialized in @PrePersist is not null. Base entity contains:</p>
  
  <pre><code>@NotNull
  @Column(name = "created_date")
  protected LocalDateTime createdDate;
  
  @PrePersist
  public void prePersist() {
      setCreatedDate(LocalDateTime.now());
      setModifiedDate(LocalDateTime.now());
      validateEntity();
  }
  
  private void validateEntity() {
      Set&lt;ConstraintViolation&lt;BaseEntity&gt;&gt; violations = Validation.buildDefaultValidatorFactory().getValidator().validate(this);
      if(!violations.isEmpty()) {
          throw new RuntimeException(new ValidationMessageBuilder().build(violations));
      }
  }
  </code></pre>
  
  <p>I've checked the objects under debugger, and for example Assignment is object @17609 and Parent is @17608.</p>
  
  <p>Exception is raised, after invoking save() method.</p>
  
  <pre><code>java.lang.RuntimeException: may not be null =&gt; com.foo.bar.model.domain.Assignment.parent.assignments.createdDate.
  at com.foo.bar.model.BaseEntity.validateEntity(BaseEntity.java:70)
  at com.foo.bar.model.BaseEntity.prePersist(BaseEntity.java:58)
  </code></pre>
  
  <p>I've debugged and in @PrePersist method of Assignment entity Hibernate invokes it for another object, which is Assignment@17646, which contains Parent@17608, and parent contains collection of children with one element, which is @17609.</p>
  
  <p>Why hibernate tries to persist another object?</p>