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.hmsinc.epicenter.model.attribute.Gender.java

@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "gender")
public Set<PatientDetail> getPatientDetails() {
    return this.patientDetails;
}

From source file:com.infinities.keystone4j.model.assignment.Domain.java

@JsonView(Views.All.class)
@OneToMany(fetch = FetchType.LAZY, mappedBy = "domain", cascade = CascadeType.ALL)
public Set<Project> getProjects() {
    return projects;
}

From source file:com.impetus.kundera.lifecycle.states.NodeState.java

/**
 * @param nodeStateContext/*w  ww. ja v  a 2  s.  com*/
 */
protected void recursivelyPerformOperation(NodeStateContext nodeStateContext, OPERATION operation) {
    Map<NodeLink, Node> children = nodeStateContext.getChildren();
    if (children != null) {
        for (NodeLink nodeLink : children.keySet()) {
            List<CascadeType> cascadeTypes = (List<CascadeType>) nodeLink.getLinkProperty(LinkProperty.CASCADE);

            switch (operation) {
            case PERSIST:
                if (cascadeTypes.contains(CascadeType.PERSIST) || cascadeTypes.contains(CascadeType.ALL)) {
                    Node childNode = children.get(nodeLink);
                    childNode.persist();
                }
                break;
            case MERGE:
                if (cascadeTypes.contains(CascadeType.MERGE) || cascadeTypes.contains(CascadeType.ALL)) {
                    Node childNode = children.get(nodeLink);
                    childNode.merge();
                }
                break;

            case REMOVE:
                if (cascadeTypes.contains(CascadeType.REMOVE) || cascadeTypes.contains(CascadeType.ALL)) {
                    Node childNode = children.get(nodeLink);
                    childNode.remove();
                }
                break;

            case REFRESH:
                if (cascadeTypes.contains(CascadeType.REFRESH) || cascadeTypes.contains(CascadeType.ALL)) {
                    Node childNode = children.get(nodeLink);
                    childNode.refresh();
                }
                break;
            case DETACH:
                if (cascadeTypes.contains(CascadeType.DETACH) || cascadeTypes.contains(CascadeType.ALL)) {
                    Node childNode = children.get(nodeLink);
                    childNode.detach();
                }
                break;
            }

        }
    }
}

From source file:no.abmu.user.domain.User.java

/**
 * getContactInfo./*from w ww.  j  a v a2  s. co  m*/
 * 
 * @return
 * @hibernate.many-to-one
 * cascade="all"
 *
 * @hibernate.column name="contactInfo"
 *      index="user_contactInfo_idx"
 */
@ManyToOne(cascade = { CascadeType.ALL })
@JoinColumn(name = "contactInfo")
public ContactInfo getContactInfo() {
    return contactInfo;
}

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

/**
 * @return the user//  w  w  w  .  java 2 s .c o m
 */
@ManyToOne(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY)
@JoinColumn(name = "ID_APP_USER", unique = false, nullable = false, insertable = true, updatable = true)
@org.hibernate.annotations.ForeignKey(name = "FK_ACTIVITY_1")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public EpiCenterUser getUser() {
    return user;
}

From source file:uk.nhs.cfh.dsp.snomed.expression.model.impl.AbstractExpressionImpl.java

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = AbstractExpressionImpl.class)
@JoinTable(name = "PARENT_EXPRESSIONS", joinColumns = @JoinColumn(name = "uuid"), inverseJoinColumns = @JoinColumn(name = "parent_expression_id"))
public Collection<Expression> getParentExpressions() {
    return parentExpressions;
}

From source file:com.evolveum.midpoint.repo.sql.data.common.any.RAssignmentExtension.java

@OneToMany(mappedBy = RAExtValue.ANY_CONTAINER, orphanRemoval = true)
@Cascade({ org.hibernate.annotations.CascadeType.ALL })
public Set<RAExtLong> getLongs() {
    if (longs == null) {
        longs = new HashSet<>();
    }/*  www . java2 s .  co m*/
    return longs;
}

From source file:tools.xor.db.pm.Task.java

@OneToOne(mappedBy = "auditedTask", cascade = CascadeType.ALL, orphanRemoval = true)
public Task getAuditTask() {
    return auditTask;
}

From source file:com.anite.zebra.hivemind.om.defs.ZebraProcessDefinition.java

@OneToMany(targetEntity = ZebraTaskDefinition.class, cascade = CascadeType.ALL)
@JoinTable(name = "processTaskDefinitions", joinColumns = {
        @JoinColumn(name = "processDefinitionId") }, inverseJoinColumns = @JoinColumn(name = "taskDefinitionId"))
public Set getTaskDefinitions() {
    return this.taskDefinitions;
}

From source file:com.hmsinc.epicenter.model.attribute.PatientClass.java

/**
 * @return the interactions//from  w w  w  .j  a va  2 s  .  c  om
 */
@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "patientClass")
public Set<Interaction> getInteractions() {
    return interactions;
}