I am using Hibernate to persist this bean.
import javax.persistence.*; @Entity public class Person { @Id @GeneratedValue private int id; @Column private String name; @OneToOne private Address addr; }
What is the CascadeType
for addr
?
CascadeType defaults to the empty array . See CascadeType in Annotation Type OneToOne. By default no operations are cascaded.
The cascading types supported by the hibernate framework are as follow: CascadeType. PERSIST : It means that the save() and persist() operations in the hibernate cascade to the related entities. CascadeType. MERGE : It means that the related entities are joined when the owning entity is joined.
By default, Hibernate uses lazy select fetching for collections and lazy proxy fetching for single-valued associations. These defaults make sense for most associations in the majority of applications.
CascadeType. REFRESH cascades the refresh operation to all associated entities refresh by hibernate session. If one entity is refreshed, other associated entities will also be refreshed if CascadeType. REFRESH is annotated.
CascadeType defaults to the empty array . See CascadeType in Annotation Type OneToOne
By default no operations are cascaded.
You can check the source of @OneToOne
at here . No operations are cascaded by default
/** * (Optional) The operations that must be cascaded to * the target of the association. * * <p> By default no operations are cascaded. */ CascadeType[] cascade() default {};
Read more: http://kickjava.com/src/javax/persistence/OneToOne.java.htm#ixzz1d6ZWMM2y
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With