简体   繁体   中英

default value for CascadeType in Hibernate

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM