Example usage for javax.persistence CascadeType MERGE

List of usage examples for javax.persistence CascadeType MERGE

Introduction

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

Prototype

CascadeType MERGE

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

Click Source Link

Document

Cascade merge operation

Usage

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.hmsinc.epicenter.model.surveillance.SurveillanceMethod.java

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

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

/**
 * @param nodeStateContext//  w ww  .ja  v  a  2s.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.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// ww w. j a  va 2 s  .  co m
 */
@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;
}

From source file:com.eryansky.entity.base.User.java

@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY)
// ,????//from   w  w w. j  a v a  2s .c o  m
@JoinTable(name = "T_BASE_USER_ROLE", joinColumns = { @JoinColumn(name = "USER_ID") }, inverseJoinColumns = {
        @JoinColumn(name = "ROLE_ID") })
// Fecth
//   @Fetch(FetchMode.SUBSELECT)
// ?id?.
@OrderBy("id")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = CacheConstants.HIBERNATE_CACHE_BASE)
public List<Role> getRoles() {
    return roles;
}