Example usage for javax.persistence CascadeType DETACH

List of usage examples for javax.persistence CascadeType DETACH

Introduction

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

Prototype

CascadeType DETACH

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

Click Source Link

Document

Cascade detach operation

Usage

From source file:org.dspace.orm.entity.WorkSpaceItem.java

@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.DETACH)
@JoinTable(name = "epersongroup2workspaceitem", joinColumns = {
        @JoinColumn(name = "workspace_item_id", nullable = false) }, inverseJoinColumns = {
                @JoinColumn(name = "eperson_group_id", nullable = false) })
public List<EpersonGroup> getEpersonGroups() {
    return epersonGroups;
}

From source file:org.dspace.orm.entity.EpersonGroup.java

@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.DETACH)
@JoinTable(name = "group2group", joinColumns = {
        @JoinColumn(name = "child_id", nullable = false) }, inverseJoinColumns = {
                @JoinColumn(name = "parent_id", nullable = false) })
public List<EpersonGroup> getParents() {
    return parents;
}

From source file:org.dspace.orm.entity.Community.java

@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.DETACH)
@JoinTable(name = "community2community", joinColumns = {
        @JoinColumn(name = "parent_comm_id", nullable = false) }, inverseJoinColumns = {
                @JoinColumn(name = "child_comm_id", nullable = false) })
public List<Community> getChilds() {
    return childs;
}

From source file:org.dspace.orm.entity.EpersonGroup.java

@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.DETACH)
@JoinTable(name = "group2groupcache", joinColumns = {
        @JoinColumn(name = "child_id", nullable = false) }, inverseJoinColumns = {
                @JoinColumn(name = "parent_id", nullable = false) })
public List<EpersonGroup> getAllParents() {
    return allParents;
}

From source file:org.dspace.orm.entity.Item.java

@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.DETACH)
@JoinTable(name = "item2bundle", joinColumns = {
        @JoinColumn(name = "item_id", nullable = false) }, inverseJoinColumns = {
                @JoinColumn(name = "bundle_id", nullable = false) })
public List<Bundle> getBundles() {
    return bundles;
}

From source file:org.dspace.orm.entity.EpersonGroup.java

@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.DETACH)
@JoinTable(name = "epersongroup2eperson", joinColumns = {
        @JoinColumn(name = "eperson_group_id", nullable = false) }, inverseJoinColumns = {
                @JoinColumn(name = "eperson_id", nullable = false) })
public List<Eperson> getEpersons() {
    return epersons;
}

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

/**
 * @param nodeStateContext//from www . j a  v a2  s. c om
 */
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:org.dspace.orm.entity.EpersonGroup.java

@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.DETACH)
@JoinTable(name = "epersongroup2workspaceitem", joinColumns = {
        @JoinColumn(name = "eperson_group_id", nullable = false) }, inverseJoinColumns = {
                @JoinColumn(name = "workspace_item_id", nullable = false) })
public List<WorkSpaceItem> getWorkSpaceItems() {
    return workSpaceItems;
}

From source file:org.dspace.orm.entity.Eperson.java

@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.DETACH)
@JoinTable(name = "subscription", joinColumns = {
        @JoinColumn(name = "eperson_id", nullable = false) }, inverseJoinColumns = {
                @JoinColumn(name = "collection_id", nullable = false) })
public List<Collection> getCollections() {
    return collections;
}

From source file:org.dspace.orm.entity.Eperson.java

@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.DETACH)
@JoinTable(name = "epersongroup2eperson", joinColumns = {
        @JoinColumn(name = "eperson_group_id", nullable = false) }, inverseJoinColumns = {
                @JoinColumn(name = "eperson_id", nullable = false) })
public List<EpersonGroup> getEpersonGroups() {
    return epersonGroups;
}