Example usage for javax.persistence CascadeType ALL

List of usage examples for javax.persistence CascadeType ALL

Introduction

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

Prototype

CascadeType ALL

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

Click Source Link

Document

Cascade all operations

Usage

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

/**
 * @return the disciplines/*from   w  ww .j a  v  a  2  s . c  o  m*/
 */
@OneToMany(cascade = {}, fetch = FetchType.LAZY, mappedBy = "division")
@org.hibernate.annotations.Cascade({ org.hibernate.annotations.CascadeType.ALL,
        org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
public Set<Discipline> getDisciplines() {
    return disciplines;
}

From source file:com.doculibre.constellio.entities.IndexField.java

@OneToMany(mappedBy = "indexField", cascade = { CascadeType.ALL }, orphanRemoval = true)
public Set<Categorization> getCategorizations() {
    return categorizations;
}

From source file:org.opennms.netmgt.model.OnmsIpInterface.java

/**
 * The SnmpInterface associated with this interface if any
 *
 * @return a {@link org.opennms.netmgt.model.OnmsSnmpInterface} object.
 *//*  w  w w . jav  a2  s.co  m*/
@XmlElement(name = "snmpInterface")
@ManyToOne(optional = true, fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "snmpInterfaceId")
public OnmsSnmpInterface getSnmpInterface() {
    return m_snmpInterface;
}

From source file:org.bonitasoft.engine.business.data.impl.BusinessDataServiceImpl.java

private Type getRelationType(final Entity businessObject, final String methodName)
        throws SBusinessDataRepositoryException {
    final String fieldName = ClassReflector.getFieldName(methodName);
    Annotation[] annotations;/*from  w w  w  .j  a  va 2 s.  c o  m*/
    try {
        annotations = businessObject.getClass().getDeclaredField(fieldName).getAnnotations();
    } catch (final NoSuchFieldException e) {
        return null;
    } catch (final SecurityException e) {
        throw new SBusinessDataRepositoryException(e);
    }
    for (final Annotation annotation : annotations) {
        final Set<Class<? extends Annotation>> annotationKeySet = getAnnotationKeySet();
        if (annotationKeySet.contains(annotation.annotationType())) {
            try {
                final Method cascade = annotation.getClass().getMethod("cascade");
                CascadeType[] cascadeTypes = (CascadeType[]) cascade.invoke(annotation);
                if (CascadeType.MERGE.equals(cascadeTypes[0])) {
                    return Type.AGGREGATION;
                }
                if (CascadeType.ALL.equals(cascadeTypes[0])) {
                    return Type.COMPOSITION;
                }
            } catch (Exception e) {
                throw new SBusinessDataRepositoryException(e);
            }
        }
    }
    return null;
}

From source file:org.opencustomer.db.vo.calendar.EventVO.java

@OneToMany(mappedBy = "event", cascade = CascadeType.ALL)
@Cascade({ org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
public Set<EventCalendarVO> getEventCalendars() {
    return eventCalendars;
}

From source file:com.doculibre.constellio.entities.RecordCollection.java

@OneToMany(mappedBy = "includedCollection", cascade = {
        CascadeType.ALL }, fetch = FetchType.LAZY, orphanRemoval = true)
public Set<CollectionFederation> getOwnerCollectionFederations() {
    return ownerCollectionFederations;
}

From source file:gov.nih.nci.firebird.data.Protocol.java

/**
 * @return files documenting this protocol.
 *//*from   www . ja  va  2  s  .  c o  m*/
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "protocol_firebirdfile", joinColumns = @JoinColumn(name = PROTOCOL_STRING), inverseJoinColumns = @JoinColumn(name = "firebirdfile"))
@ForeignKey(name = "protocol_fkey", inverseName = "firebirdfile_fkey")
@Cascade({ org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
public Set<FirebirdFile> getDocuments() {
    return documents;
}

From source file:velo.entity.Resource.java

/**
 * Get a list of accounts entities related to the Resource
 * //from   w  w w .  j  a  v a 2s  . c  om
 * @return A list of accounts
 */
@OneToMany(cascade = CascadeType.ALL, mappedBy = "resource", fetch = FetchType.LAZY)
public Set<AuditedAccount> getAuditedAccounts() {
    return auditedAccounts;
}

From source file:org.mitre.oauth2.model.OAuth2AccessTokenEntity.java

/**
 * @return the permissions/*from   w w w  . j a  va2 s. c o m*/
 */
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinTable(name = "access_token_permissions", joinColumns = @JoinColumn(name = "access_token_id"), inverseJoinColumns = @JoinColumn(name = "permission_id"))
public Set<Permission> getPermissions() {
    return permissions;
}

From source file:com.doculibre.constellio.entities.IndexField.java

@OneToMany(mappedBy = "indexField", cascade = { CascadeType.ALL }, orphanRemoval = true)
public Set<IndexFieldMetaMapping> getMetaMappings() {
    return metaMappings;
}