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.dp2345.entity.SetProduct.java

/**
 * ??// w w  w.jav a2  s .c  om
 * 
 * @return ?
 */
@OneToMany(mappedBy = "set_product", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set<SetProductItem> getSetProductItems() {
    return setProductItems;
}

From source file:com.dp2345.entity.Coupon.java

/**
 * ??//from www  .j  av  a  2 s.c  o  m
 * 
 * @return ?
 */
@OneToMany(mappedBy = "coupon", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set<CouponCode> getCouponCodes() {
    return couponCodes;
}

From source file:edu.uiowa.icts.bluebutton.domain.Person.java

/*****clinicalDocuments*****/
@OneToMany(fetch = FetchType.LAZY, mappedBy = "person", targetEntity = ClinicalDocument.class, cascade = CascadeType.REMOVE)
public Set<ClinicalDocument> getClinicalDocuments() {
    return clinicalDocuments;
}

From source file:com.jeefuse.system.security.model.GsysFunction.java

/**
 * ------------------------------------------------------------------------
 * gsysRelRoleFunctions// ww  w  .j a  v a  2 s. c om
 * ------------------------------------------------------------------------
 * 
 * @generated
 */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "gsysFunction", cascade = CascadeType.REMOVE)
public List<GsysRelRoleFunction> getGsysRelRoleFunctions() {
    if (this.gsysRelRoleFunctions == null) {
        this.gsysRelRoleFunctions = new ArrayList<GsysRelRoleFunction>();
    }
    return gsysRelRoleFunctions;
}

From source file:org.grails.datastore.mapping.engine.NativeEntryEntityPersister.java

/**
 * Delete many-to-ones after owner delete.
 *//* ww  w. j  av a 2s  .c o  m*/
protected void cascadeAfterDelete(PersistentEntity persistentEntity, EntityAccess entityAccess, K key,
        Object instance) {

    List<PersistentProperty> props = persistentEntity.getPersistentProperties();
    for (PersistentProperty prop : props) {
        String propertyKey = getPropertyKey(prop);
        if (prop instanceof Basic) {
            Object propValue = entityAccess.getProperty(prop.getName());
        } else if (prop instanceof OneToMany) {
            OneToMany oneToMany = (OneToMany) prop;
            if (oneToMany.isOwningSide() && oneToMany.doesCascade(CascadeType.REMOVE)) {
                Object propValue = entityAccess.getProperty(oneToMany.getName());
                if (propValue instanceof Collection) {
                    cascadeDeleteCollection((Collection) propValue);
                }
            }
        } else if (prop instanceof ToOne) {
            ToOne association = (ToOne) prop;
            if (!(prop instanceof Embedded) && !(prop instanceof EmbeddedCollection)
                    && association.doesCascade(CascadeType.REMOVE)) {
                if (association.isOwningSide()) {
                    Object value = entityAccess.getProperty(association.getName());
                    if (value != null) {
                        Persister persister = session.getPersister(value);
                        if (persister != null)
                            persister.delete(value);
                    }
                }
            }
        }
    }
}

From source file:edu.ku.brc.specify.datamodel.SpecifyUser.java

/**
 * @return - /* w w  w  .java  2s  .  co m*/
 * Set<AppResource>
 */
@OneToMany(cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY, mappedBy = "specifyUser")
@org.hibernate.annotations.Cascade({ org.hibernate.annotations.CascadeType.ALL,
        org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
public Set<SpAppResource> getSpAppResources() {
    return this.spAppResources;
}

From source file:com.openlegacy.enterprise.ide.eclipse.editors.pages.details.jpa.FieldsJpaManyToOneFieldDetailsPage.java

private static String[] getCascadeItems() {
    List<String> list = new ArrayList<String>();
    list.add(CascadeType.ALL.toString());
    list.add(CascadeType.PERSIST.toString());
    list.add(CascadeType.MERGE.toString());
    list.add(CascadeType.REMOVE.toString());
    list.add(CascadeType.REFRESH.toString());
    list.add(CascadeType.DETACH.toString());
    return list.toArray(new String[] {});
}

From source file:com.jeefuse.system.security.model.GsysUser.java

/**
 * ------------------------------------------------------------------------
 * gsysOperatelogs/*w  w w.ja va 2  s. co m*/
 * ------------------------------------------------------------------------
 * 
 * @generated
 */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "gsysUser", cascade = CascadeType.REMOVE)
public List<GsysOperatelog> getGsysOperatelogs() {
    if (this.gsysOperatelogs == null) {
        this.gsysOperatelogs = new ArrayList<GsysOperatelog>();
    }
    return gsysOperatelogs;
}

From source file:net.shopxx.entity.Order.java

@OneToMany(mappedBy = "order", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@OrderBy("createDate asc")
public Set<PaymentLog> getPaymentLogs() {
    return paymentLogs;
}

From source file:com.jeefuse.system.security.model.GsysUser.java

/**
 * ------------------------------------------------------------------------
 * gsysOperatelogs//from  w  w  w.j  a v a 2  s .c  o  m
 * ------------------------------------------------------------------------
 * 
 * @generated
 */
@OneToMany(fetch = FetchType.LAZY, mappedBy = "gsysUser", cascade = CascadeType.REMOVE)
public List<GsysLoginlog> getGsysLoginlogs() {
    if (this.gsysLoginlogs == null) {
        this.gsysLoginlogs = new ArrayList<GsysLoginlog>();
    }
    return gsysLoginlogs;
}