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:org.batoo.jpa.core.impl.model.mapping.AssociationMapping.java

/**
 * @param parent//  w ww  .j a  v a 2s . c o m
 *            the parent mapping
 * @param metadata
 *            the metadata
 * @param attribute
 *            the attribute
 * 
 * @since $version
 * @author hceylan
 */
public AssociationMapping(ParentMapping<?, Z> parent, AssociationAttributeMetadata metadata,
        AttributeImpl<? super Z, X> attribute) {
    super(parent, attribute, attribute.getJavaType(), attribute.getName());

    if ((metadata instanceof MappableAssociationAttributeMetadata)
            && StringUtils.isNotBlank(((MappableAssociationAttributeMetadata) metadata).getMappedBy())) {
        this.mappedBy = ((MappableAssociationAttributeMetadata) metadata).getMappedBy();
    } else {
        this.mappedBy = null;
    }

    this.eager = attribute.isCollection() || (this.mappedBy == null)
            ? metadata.getFetchType() == FetchType.EAGER
            : true;

    if (metadata instanceof OrphanableAssociationAttributeMetadata) {
        this.removesOrphans = ((OrphanableAssociationAttributeMetadata) metadata).removesOrphans();
    } else {
        this.removesOrphans = false;
    }

    this.cascadesDetach = metadata.getCascades().contains(CascadeType.ALL)
            || metadata.getCascades().contains(CascadeType.DETACH);
    this.cascadesMerge = metadata.getCascades().contains(CascadeType.ALL)
            || metadata.getCascades().contains(CascadeType.MERGE);
    this.cascadesPersist = metadata.getCascades().contains(CascadeType.ALL)
            || metadata.getCascades().contains(CascadeType.PERSIST);
    this.cascadesRefresh = metadata.getCascades().contains(CascadeType.ALL)
            || metadata.getCascades().contains(CascadeType.REFRESH);
    this.cascadesRemove = metadata.getCascades().contains(CascadeType.ALL)
            || metadata.getCascades().contains(CascadeType.REMOVE);
}

From source file:com.hmsinc.epicenter.model.health.PatientDetail.java

@ManyToOne(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY)
@JoinColumn(name = "ID_PATIENT", unique = false, nullable = false, insertable = true, updatable = true)
@org.hibernate.annotations.ForeignKey(name = "FK_PATIENT_DETAIL_1")
public Patient getPatient() {
    return this.patient;
}

From source file:com.hmsinc.epicenter.model.workflow.WorkflowTransition.java

/**
 * @return the toState/*w w w. j a v a 2s  .  c  om*/
 */
@ManyToOne(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY)
@JoinColumn(name = "ID_STATE_TO", unique = false, nullable = false, insertable = true, updatable = true)
@org.hibernate.annotations.ForeignKey(name = "FK_WORKFLOW_TRANSITION_2")
public WorkflowState getToState() {
    return toState;
}

From source file:com.infinities.skyport.compute.entity.ComputeObject.java

@Override
@OneToMany(fetch = FetchType.LAZY, mappedBy = "templateBaseEntity", cascade = CascadeType.ALL)
public NetworkAdapters getNics() {
    return nics;
}

From source file:no.abmu.questionnarie.domain.MainReportSchema.java

/**
 * @hibernate.set lazy="false"//from w  w  w .  j a v  a2 s .c  o m
 * cascade="save-update"
 * @hibernate.key column="FK_RS_SUBREPORT_ID"
 * @hibernate.one-to-many class="no.abmu.finances.domain.SubReportSchema"
 * @hibernate.collection-key column="FK_RS_SUBREPORT_ID"
 * @hibernate.collection-one-to-many class="no.abmu.finances.domain.SubReportSchema"
 * @hibernate.collection-cache usage="nonstrict-read-write"
 */
@OneToMany(cascade = { CascadeType.ALL })
@JoinColumn(name = "mrs_fk")
//    @Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public Set<SubReportSchema> getSubReportSchemas() {
    return subReportSchemas;
}

From source file:org.opencustomer.db.vo.crm.ContactVO.java

@OneToMany(mappedBy = "contact", cascade = CascadeType.ALL)
@Cascade({ org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
public Set<PersonContactVO> getPersonContacts() {
    return personContacts;
}

From source file:onl.netfishers.netshot.device.DeviceGroup.java

/**
 * Gets the applied software rules.//from   w w  w. j  a  v a  2 s . com
 *
 * @return the applied software rules
 */
@OneToMany(cascade = CascadeType.ALL, mappedBy = "targetGroup")
public Set<SoftwareRule> getAppliedSoftwareRules() {
    return appliedSoftwareRules;
}

From source file:com.hmsinc.epicenter.model.workflow.Attachment.java

/**
 * @return the investigation//  w  ww .j av  a2s .  com
 */
@ManyToOne(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY)
@JoinColumn(name = "ID_INVESTIGATION", unique = false, nullable = false, insertable = true, updatable = true)
@org.hibernate.annotations.ForeignKey(name = "FK_ATTACHMENT_2")
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
public Investigation getInvestigation() {
    return investigation;
}

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

/**
 * @return the userAuth//from   ww w.ja  va2 s.  com
 */
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "user_auth_id")
public SavedUserAuthentication getUserAuth() {
    return userAuth;
}

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

@OneToMany(fetch = FetchType.LAZY, mappedBy = "authorizationGroupInternal", cascade = CascadeType.ALL)
private Set<RoleAssignmentPE> getRoleAssignmentsInternal() {
    return roleAssignments;
}