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:com.hmsinc.epicenter.model.permission.EpiCenterUser.java

/**
 * @return the assignedEvents//from   w  w  w.  j a v  a2s .c  o  m
 */
@OneToMany(cascade = { CascadeType.PERSIST,
        CascadeType.MERGE }, fetch = FetchType.LAZY, mappedBy = "assignedTo")
public Set<Investigation> getAssignedEvents() {
    return assignedEvents;
}

From source file:com.hmsinc.epicenter.model.permission.EpiCenterUser.java

/**
 * @return the activities/*from  w  w  w  .j a v a 2s  .co  m*/
 */
@OneToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY, mappedBy = "user")
public Set<Activity> getActivities() {
    return activities;
}

From source file:org.opennms.netmgt.model.OnmsNode.java

/**
 * <p>getCategories</p>//  w ww  .  ja  v a  2 s .  c o m
 *
 * @return a {@link java.util.Set} object.
 */
@XmlElement(name = "categories")
@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinTable(name = "category_node", joinColumns = { @JoinColumn(name = "nodeId") }, inverseJoinColumns = {
        @JoinColumn(name = "categoryId") })
public Set<OnmsCategory> getCategories() {
    return m_categories;
}

From source file:edu.harvard.med.screensaver.model.libraries.Library.java

@ManyToOne(fetch = FetchType.EAGER, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "ownerScreenerId", nullable = true)
@org.hibernate.annotations.ForeignKey(name = "fk_library_to_owner")
//  @org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.PROXY)
@org.hibernate.annotations.Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE })

public ScreeningRoomUser getOwner() {
    return _owner;
}

From source file:com.mmnaseri.dragonfly.metadata.impl.AnnotationTableMetadataResolver.java

private static CascadeMetadata getCascadeMetadata(Method method) {
    final List<CascadeType> cascadeTypes = new ArrayList<CascadeType>();
    if (method.isAnnotationPresent(OneToOne.class)) {
        cascadeTypes.addAll(Arrays.asList(method.getAnnotation(OneToOne.class).cascade()));
    } else if (method.isAnnotationPresent(OneToMany.class)) {
        cascadeTypes.addAll(Arrays.asList(method.getAnnotation(OneToMany.class).cascade()));
    } else if (method.isAnnotationPresent(ManyToOne.class)) {
        cascadeTypes.addAll(Arrays.asList(method.getAnnotation(ManyToOne.class).cascade()));
    } else if (method.isAnnotationPresent(ManyToMany.class)) {
        cascadeTypes.addAll(Arrays.asList(method.getAnnotation(ManyToMany.class).cascade()));
    }//from  w ww .j  a  v  a 2  s  .  c  om
    final boolean cascadeAll = cascadeTypes.contains(CascadeType.ALL);
    return new ImmutableCascadeMetadata(cascadeAll || cascadeTypes.contains(CascadeType.PERSIST),
            cascadeAll || cascadeTypes.contains(CascadeType.MERGE),
            cascadeAll || cascadeTypes.contains(CascadeType.REMOVE),
            cascadeAll || cascadeTypes.contains(CascadeType.REFRESH));
}

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

/**
 * @hibernate.set lazy="true"/*from   w w  w . j a va2s.  com*/
 * inverse="true"
 * cascade="save-update"
 * table="FINANCE_REPORT_SCHEMA_ACCOUNT"
 * @hibernate.key column="FK_ACCOUNT_ID"
 * @hibernate.many-to-many class="no.abmu.finances.domain.ReportSchema"
 * column="FK_REPORT_SCHEMA_ID"
 * @hibernate.cache usage="nonstrict-read-write"
 * @hibernate.collection-key column="FK_ACCOUNT_ID"
 * @hibernate.collection-many-to-many class="no.abmu.finances.domain.ReportSchema"
 * column="FK_REPORT_SCHEMA_ID"
 */
//    @ManyToMany(cascade = {CascadeType.ALL})
//    @ForeignKey(name = "FK_REPORT_SCHEMA_ID", inverseName = "FK_REPORT_SCHEMA_ID")
//    @JoinTable(
//            name = "QUESTIONNARIE_ACCOUNT_REPORTSCHEMA"
////            schema = "QUESTIONNARIE"
//    )
@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER /* TODO FETCH */
)
@JoinTable(
        //            schema = "QUESTIONNARIE"
        name = "QUESTIONNARIE_ACCOUNT_MAIN_REPORT_SCHEMA", joinColumns = {
                @JoinColumn(name = "ACCOUNT_ID") }, inverseJoinColumns = { @JoinColumn(name = "RS_ID") })
//    @Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public Set<MainReportSchema> getMainReportSchemas() {
    return mainReportSchemas;
}

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

@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER /* TODO FETCH */
)
@JoinTable(/*from w w  w . j  a  va 2  s . co m*/
        //            schema = "QUESTIONNARIE"
        name = "QUESTIONNARIE_ACCOUNT_SUB_REPORT_SCHEMA", joinColumns = {
                @JoinColumn(name = "ACCOUNT_ID") }, inverseJoinColumns = { @JoinColumn(name = "RS_ID") })
//    @Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public Set<SubReportSchema> getSubReportSchemas() {
    return subReportSchemas;
}

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

/**
 * @hibernate.set lazy="true"// ww  w  .  ja  va  2  s  .c om
 * inverse="true"
 * cascade="save-update"
 * table="FINANCE_ACCOUNT_POST"
 * @hibernate.key column="FK_POST_ID"
 * @hibernate.many-to-many class="no.abmu.finances.domain.Account"
 * column="FK_ACCOUNT_ID"
 * @hibernate.cache usage="nonstrict-read-write"
 * @hibernate.collection-key column="FK_POST_ID"
 * @hibernate.collection-many-to-many class="no.abmu.finances.domain.Account"
 * column="FK_ACCOUNT_ID"
 */
//    @ManyToMany(cascade = {CascadeType.ALL})
//    @ForeignKey(name = "FK_ACCOUNT_ID", inverseName = "FK_ACCOUNT_ID")
//    @JoinTable(
//            name = "QUESTIONNARIE_
////            schema = "QUESTIONNARIE"
//    )
@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, mappedBy = "posts")
//    @Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public Set<Account> getAccounts() {
    return accounts;
}

From source file:org.apache.camel.bam.model.ActivityState.java

@ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
public ProcessInstance getProcessInstance() {
    return processInstance;
}

From source file:org.apache.camel.bam.model.ActivityState.java

@ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
public ActivityDefinition getActivityDefinition() {
    return activityDefinition;
}