Example usage for javax.persistence CascadeType REMOVE

List of usage examples for javax.persistence CascadeType REMOVE

Introduction

In this page you can find the example usage for javax.persistence CascadeType REMOVE.

Prototype

CascadeType REMOVE

To view the source code for javax.persistence CascadeType REMOVE.

Click Source Link

Document

Cascade remove operation

Usage

From source file:com.sammyun.entity.Member.java

/**
 * ???/*from w  w w .ja  va2s  . c o  m*/
 * 
 * @return
 * @see [?#?#?]
 */
@OneToMany(mappedBy = "leaveMember", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set<TeacherAskLeave> getTeacherAskLeaves() {
    return teacherAskLeaves;
}

From source file:com.sammyun.entity.Member.java

/**
 * @return  approvalAskLeaves/* ww  w  .j  ava 2 s. c o  m*/
 */
@OneToMany(mappedBy = "approvalMember", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set<TeacherAskLeave> getApprovalAskLeaves() {
    return approvalAskLeaves;
}

From source file:com.sammyun.entity.Member.java

/**
 * @return  appUsers/*from  ww  w.j a  v a 2 s. c o  m*/
 */
@OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set<AppUser> getAppUsers() {
    return appUsers;
}

From source file:com.mmnaseri.dragonfly.metadata.impl.AnnotationTableMetadataResolver.java

private static CascadeMetadata getCascadeMetadata(Method method) {
    final List<CascadeType> cascadeTypes = new ArrayList<CascadeType>();
    if (method.isAnnotationPresent(OneToOne.class)) {
        cascadeTypes.addAll(Arrays.asList(method.getAnnotation(OneToOne.class).cascade()));
    } else if (method.isAnnotationPresent(OneToMany.class)) {
        cascadeTypes.addAll(Arrays.asList(method.getAnnotation(OneToMany.class).cascade()));
    } else if (method.isAnnotationPresent(ManyToOne.class)) {
        cascadeTypes.addAll(Arrays.asList(method.getAnnotation(ManyToOne.class).cascade()));
    } else if (method.isAnnotationPresent(ManyToMany.class)) {
        cascadeTypes.addAll(Arrays.asList(method.getAnnotation(ManyToMany.class).cascade()));
    }//from w ww  .ja  va 2s.  c om
    final boolean cascadeAll = cascadeTypes.contains(CascadeType.ALL);
    return new ImmutableCascadeMetadata(cascadeAll || cascadeTypes.contains(CascadeType.PERSIST),
            cascadeAll || cascadeTypes.contains(CascadeType.MERGE),
            cascadeAll || cascadeTypes.contains(CascadeType.REMOVE),
            cascadeAll || cascadeTypes.contains(CascadeType.REFRESH));
}

From source file:gov.guilin.entity.Member.java

/**
 * /*from   w ww.jav a2  s .co m*/
 * : ???
 * @return ?
 */
@OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set<SupplierCompanySale> getSupplierCompanySale() {
    return supplierCompanySale;
}

From source file:net.groupbuy.entity.Product.java

/**
 * ?// ww  w.  j a  va 2s.c  o m
 * 
 * @return 
 */
@OneToMany(mappedBy = "product", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set<Review> getReviews() {
    return reviews;
}

From source file:net.groupbuy.entity.Product.java

/**
 * ?/*  www . j  a  v a2  s.  co  m*/
 * 
 * @return 
 */
@OneToMany(mappedBy = "product", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set<Consultation> getConsultations() {
    return consultations;
}

From source file:net.groupbuy.entity.Product.java

/**
 * ?//  w  w w.  j av  a 2  s .c  o  m
 * 
 * @return 
 */
@OneToMany(mappedBy = "product", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set<CartItem> getCartItems() {
    return cartItems;
}

From source file:net.groupbuy.entity.Product.java

/**
 * ?/*w w w .  j  a v  a2 s.  co  m*/
 * 
 * @return 
 */
@OneToMany(mappedBy = "product", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set<ProductNotify> getProductNotifies() {
    return productNotifies;
}

From source file:org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.java

/**
 * Set cascades on relation./*from  w ww .j av  a 2s . c  o m*/
 */
private void setCascades(ValueMetaData vmd, CascadeType[] cascades) {
    for (CascadeType cascade : cascades) {
        if (cascade == CascadeType.ALL || cascade == CascadeType.REMOVE)
            vmd.setCascadeDelete(ValueMetaData.CASCADE_IMMEDIATE);
        if (cascade == CascadeType.ALL || cascade == CascadeType.PERSIST)
            vmd.setCascadePersist(ValueMetaData.CASCADE_IMMEDIATE);
        if (cascade == CascadeType.ALL || cascade == CascadeType.MERGE)
            vmd.setCascadeAttach(ValueMetaData.CASCADE_IMMEDIATE);
        if (cascade == CascadeType.ALL || cascade == CascadeType.DETACH)
            vmd.setCascadeDetach(ValueMetaData.CASCADE_IMMEDIATE);
        if (cascade == CascadeType.ALL || cascade == CascadeType.REFRESH)
            vmd.setCascadeRefresh(ValueMetaData.CASCADE_IMMEDIATE);
    }
}