Example usage for javax.persistence CascadeType PERSIST

List of usage examples for javax.persistence CascadeType PERSIST

Introduction

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

Prototype

CascadeType PERSIST

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

Click Source Link

Document

Cascade persist operation

Usage

From source file:com.eryansky.entity.sys.DictionaryType.java

@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "GROUP_CODE", referencedColumnName = "CODE")
public DictionaryType getGroupDictionaryType() {
    return groupDictionaryType;
}

From source file:example.FunWithPermissions.java

@ReadPermission(any = { NegativeIntegerUserCheck.class })
@UpdatePermission(any = { NegativeIntegerUserCheck.class })
@OneToMany(targetEntity = Child.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
public Set<Child> getRelation1() {
    return relation1;
}

From source file:mx.ecosur.multigame.gente.entity.GentePlayer.java

@OneToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER)
public Set<Tessera> getTesseras() {
    if (tesseras == null)
        tesseras = new HashSet<Tessera>();
    return tesseras;
}

From source file:mx.ecosur.multigame.gente.entity.GentePlayer.java

@OneToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER)
public Set<Tria> getTrias() {
    if (trias == null)
        trias = new HashSet<Tria>();
    return trias;
}

From source file:com.eryansky.entity.sys.Dictionary.java

@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "PARENT_CODE", referencedColumnName = "CODE")
public Dictionary getParentDictionary() {
    return parentDictionary;
}

From source file:com.cubeia.backoffice.users.entity.User.java

@Fetch(FetchMode.JOIN)
@OneToOne(fetch = FetchType.EAGER, cascade = { CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE })
@JoinColumn(name = "information_fk", nullable = true)
public UserInformation getInformation() {
    return information;
}

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

/**
 * @param nodeStateContext//from   ww w  .  ja  v a2s .  c  o m
 */
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:com.hmsinc.epicenter.model.surveillance.SurveillanceMethod.java

/**
 * @return the tasks/*from  w w w  .ja  v  a 2 s.co  m*/
 */
@ManyToMany(cascade = { CascadeType.PERSIST,
        CascadeType.MERGE }, mappedBy = "methods", targetEntity = SurveillanceTask.class)
public Set<SurveillanceTask> getTasks() {
    return tasks;
}

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

@OneToMany(mappedBy = "connectorType", cascade = { CascadeType.PERSIST, CascadeType.MERGE })
public Set<ConnectorInstance> getConnectorInstances() {
    return connectorInstances;
}

From source file:com.hmsinc.epicenter.model.surveillance.SurveillanceSet.java

/**
 * @return the organization//  w  ww  .j  a v a  2  s  .c  om
 */
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY)
@JoinColumn(name = "ID_ORGANIZATION", unique = false, nullable = true, insertable = true, updatable = true)
@ForeignKey(name = "FK_SURVEILLANCE_SET_1")
public Organization getOrganization() {
    return organization;
}