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.Shop.java

/**
 * ?/*from   w  w w  . j ava2 s  .  c o  m*/
 * 
 * @return 
 */
@OneToMany(mappedBy = "shop", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@OrderBy("createDate desc")
public Set<Review> getReviews() {
    return reviews;
}

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

/**
 * ?/*from   w  w w  .  j  a v  a 2  s  . c  om*/
 * 
 * @return 
 */
@OneToMany(mappedBy = "shop", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
@OrderBy("createDate desc")
public Set<Consultation> getConsultations() {
    return consultations;
}

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

/**
 * ?
 * 
 * @return 
 */
@OneToOne(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Cart getCart() {
    return cart;
}

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

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

From source file:org.grails.datastore.mapping.gemfire.engine.GemfireEntityPersister.java

private void cascadeDelete(PersistentEntity persistentEntity, Object obj, EntityAccess access) {
    final List<Association> associations = persistentEntity.getAssociations();
    for (Association association : associations) {
        if (association.doesCascade(CascadeType.REMOVE)) {
            if (association instanceof ToOne) {
                ToOne toOne = (ToOne) association;

                final Object associatedObject = access.getProperty(toOne.getName());
                if (associatedObject != null && !associatedObject.equals(obj)) {
                    session.delete(associatedObject);
                }/*from   w  w  w  .j a  v a  2  s  .  co m*/
            } else if (association instanceof OneToMany) {
                Object associatedObjects = access.getProperty(association.getName());
                if (associatedObjects instanceof Iterable) {
                    session.delete((Iterable) associatedObjects);
                }
            }
        }
    }
}

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

/**
 * ??//ww w.  j  av a2  s  .c  o  m
 * 
 * @return ?
 */
@OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set<Order> getOrders() {
    return orders;
}

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

/**
 * @return  systemSuggests//from w  ww.j  ava2s  .com
 */
@OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set<SystemSuggest> getSystemSuggests() {
    return systemSuggests;
}

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

/**
 * ?/*from w  ww  .j a va  2s.  co  m*/
 * 
 * @return 
 */
@OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set<Deposit> getDeposits() {
    return deposits;
}

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

/**
 * @return  timeCards//w  ww . j av a  2 s.  c  om
 */
@OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set<TimeCard> getTimeCards() {
    return timeCards;
}

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

/**
 * ??//from w w w.j av  a  2 s  .  com
 * 
 * @return ?
 */
@OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
public Set<Payment> getPayments() {
    return payments;
}