title: Hibernate cascades : Object references an unsaved transient instance - save the transient instance before flushing
body: <pre><code>@Entity
  @Table(name = "parent")
  public final class Parent extends Base {
  
  @OneToOne(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER)
  private Person person;
  </code></pre>
  
  <p>and doing (amongst other things) this :</p>
  
  <pre><code>Parent parent = new Parent();
  Person person = new Person();
  parent.setPerson(person);
  session.save(parent);
  </code></pre>
  
  <p>I get the mentioned exception ? </p>
  
  <p>Do I manually need to call session.save(person) before ? do I have to add a cascade type annotation to the childs class definition(where it references the parent) ?</p>
  
  <p>Or have I missed something else obvious ?</p>
  
  <p>I don't want to use CascadeType.ALL as when a parent is deleted I want to keep the person(child).</p>
  
  <p>Both entities/tables extend a common Base table : </p>
  
  <pre><code>@MappedSuperclass()
  public abstract class Base {
  
      @Id
      @GeneratedValue(strategy=GenerationType.AUTO)
      private Integer id;
  
      public Integer getId() {
      return id;
      }
  </code></pre>
  
  <p>Will this effect which cascade type is required ?</p>