我正在使用Hibernate来持久保存这个bean。
import javax.persistence.*;
@Entity
public class Person {
@Id @GeneratedValue
private int id;
@Column
private String name;
@OneToOne
private Address addr;
}
CascadeType
的{{1}}是什么?
答案 0 :(得分:72)
CascadeType 默认为空数组。见CascadeType in Annotation Type OneToOne
默认情况下,不会级联任何操作。
答案 1 :(得分:20)
您可以在here查看@OneToOne
的来源。默认情况下,不会级联任何操作
/**
* (Optional) The operations that must be cascaded to
* the target of the association.
*
* <p> By default no operations are cascaded.
*/
CascadeType[] cascade() default {};
了解详情:http://kickjava.com/src/javax/persistence/OneToOne.java.htm#ixzz1d6ZWMM2y