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:com.anite.zebra.hivemind.om.state.ZebraProcessInstance.java

/**
 * @return/*from   w w w.j  a v a  2  s  . c o  m*/
 */
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "processInstanceId")
public Set<ZebraTaskInstance> getTaskInstances() {
    return this.taskInstances;
}

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

/**
 * The services on this node/*from www. j a  va2  s .co  m*/
 *
 * @return a {@link java.util.Set} object.
 */
@XmlTransient
@OneToMany(mappedBy = "ipInterface", orphanRemoval = true, cascade = CascadeType.ALL)
@org.hibernate.annotations.Cascade(org.hibernate.annotations.CascadeType.ALL)
public Set<OnmsMonitoredService> getMonitoredServices() {
    return m_monitoredServices;
}

From source file:com.haulmont.cuba.core.global.MetadataTools.java

/**
 * Determine whether an object denoted by the given property is merged into persistence context together with the
 * owning object. This is true if the property is ManyToMany, or if it is OneToMany with certain CascadeType
 * defined.// ww w  .  j  a  va 2  s . c om
 */
public boolean isCascade(MetaProperty metaProperty) {
    Objects.requireNonNull(metaProperty, "metaProperty is null");
    OneToMany oneToMany = metaProperty.getAnnotatedElement().getAnnotation(OneToMany.class);
    if (oneToMany != null) {
        final Collection<CascadeType> cascadeTypes = Arrays.asList(oneToMany.cascade());
        if (cascadeTypes.contains(CascadeType.ALL) || cascadeTypes.contains(CascadeType.MERGE)) {
            return true;
        }
    }
    ManyToMany manyToMany = metaProperty.getAnnotatedElement().getAnnotation(ManyToMany.class);
    if (manyToMany != null && StringUtils.isBlank(manyToMany.mappedBy())) {
        return true;
    }
    return false;
}

From source file:gov.nih.nci.firebird.data.user.FirebirdUser.java

/**
 * @return the sponsorRoles//from   w ww .  ja  v  a2 s.c  o  m
 */
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL)
@Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
public Set<SponsorRole> getSponsorRoles() {
    return sponsorRoles;
}

From source file:org.projectforge.plugins.crm.ContactDO.java

/**
 * Get the contact entries for this object.
 *///w  w  w.  ja  v a  2  s .c  o m
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true, mappedBy = "contact", targetEntity = ContactEntryDO.class)
@IndexColumn(name = "number", base = 1)
public Set<ContactEntryDO> getContactEntries() {
    return this.contactEntries;
}

From source file:com.evolveum.midpoint.repo.sql.data.common.container.RAssignment.java

@Where(clause = RAssignmentReference.REFERENCE_TYPE + "= 1")
@OneToMany(mappedBy = RAssignmentReference.F_OWNER, orphanRemoval = true)
//    @JoinTable(foreignKey = @ForeignKey(name = "none"))
@Cascade({ org.hibernate.annotations.CascadeType.ALL })
@JaxbPath(itemPath = { @JaxbName(localPart = "metadata"), @JaxbName(localPart = "modifyApproverRef") })
public Set<RAssignmentReference> getModifyApproverRef() {
    if (modifyApproverRef == null) {
        modifyApproverRef = new HashSet<>();
    }/*ww w  . j a  v  a2  s.c  o  m*/
    return modifyApproverRef;
}

From source file:com.medigy.persist.model.person.Person.java

@OneToMany(cascade = CascadeType.ALL, mappedBy = "person")
@OrderBy(value = "fromDate asc") // Order a collection using SQL ordering (not HQL ordering)
@Size(min = 1)//from   www. jav a2s . co  m
public List<Gender> getGenders() {
    return genders;
}

From source file:com.fiveamsolutions.nci.commons.audit.AuditLogRecord.java

/**
 * @return the details/* ww  w.  j  a  v a2 s .  c om*/
 */
@OneToMany(mappedBy = "record", cascade = CascadeType.ALL)
@OrderBy(value = "id asc")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public Set<AuditLogDetail> getDetails() {
    return details;
}

From source file:edu.harvard.med.screensaver.model.libraries.Library.java

/**
 * Get the set of wells./*  w w  w  .  j a v a2 s  . co  m*/
 *
 * @return the wells
 */
@OneToMany(mappedBy = "library", cascade = { CascadeType.ALL })
@Sort(type = SortType.NATURAL)
public SortedSet<Well> getWells() {
    return _wells;
}

From source file:ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE.java

@Override
@OneToMany(fetch = FetchType.LAZY, mappedBy = "experimentParentInternal", cascade = CascadeType.ALL)
@Cascade(value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
@IndexedEmbedded(prefix = SearchFieldConstants.PREFIX_ATTACHMENT)
@Fetch(FetchMode.SUBSELECT)/*from  ww w.j  av a  2s . co m*/
protected Set<AttachmentPE> getInternalAttachments() {
    return attachments;
}