Hibernate Add Model with OneToMany
<p>I have got an PersonModel which has an address.<br>
Looks like that:</p>

<pre><code>public class PersonModel {
    @ManyToOne(fetch = FetchType.LAZY)
    private AddressModel address;
}

public class AddressModel {
    private String street;
    private String city;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "address", cascade = CascadeType.ALL)
    private Set&lt;PersonModel&gt; persons;
}
</code></pre>

<p>Now, when I get this JSON from my Client:</p>

<pre><code>{
    "person": {
        "address": {
            "street": "Examplestreet",
            "city": "Examplevillage"
        }
    }
}
</code></pre>

<p>And try to save it like that:</p>

<pre><code>personModelRepository.save(myJSON.person);
</code></pre>

<p>Hibernate will always throw a <strong>TransientPropertyValueException</strong>.  </p>

<blockquote>
  <p>object references an unsaved transient instance - save the transient instance before flushing</p>
</blockquote>

<p>Do I really have to save every single DB-Entry related to person first or is there another way?</p>