Java Code Examples for javax.persistence.CascadeType#MERGE

The following examples show how to use javax.persistence.CascadeType#MERGE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Reference.java    From livingdoc-core with GNU General Public License v3.0 5 votes vote down vote up
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "SPECIFICATION_ID")
public Specification getSpecification() {
    return specification;
}
 
Example 2
Source File: Reference.java    From livingdoc-core with GNU General Public License v3.0 5 votes vote down vote up
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "SUT_ID")
public SystemUnderTest getSystemUnderTest() {
    return systemUnderTest;
}
 
Example 3
Source File: TaskDO.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
/** -> Gantt */
@Deprecated
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE}, targetEntity = TaskDO.class)
@JoinColumn(name = "gantt_predecessor_fk")
public TaskDO getGanttPredecessor()
{
  return ganttPredecessor;
}
 
Example 4
Source File: ReflectiveClone.java    From development with Apache License 2.0 5 votes vote down vote up
private static boolean needsToCascade(Field field) {
    Class<?> fieldtype = field.getType();
    if (!DomainObject.class.isAssignableFrom(fieldtype))
        return false;
    Annotation ann;
    CascadeType[] cascades = null;
    ann = field.getAnnotation(OneToOne.class);
    if (ann != null) {
        cascades = ((OneToOne) ann).cascade();
    } else {
        ann = field.getAnnotation(OneToMany.class);
        if (ann != null) {
            cascades = ((OneToMany) ann).cascade();
        } else {
            ann = field.getAnnotation(ManyToOne.class);
            if (ann != null) {
                cascades = ((ManyToOne) ann).cascade();
            } else {
                ann = field.getAnnotation(ManyToMany.class);
                if (ann != null) {
                    cascades = ((ManyToMany) ann).cascade();
                }
            }
        }
    }
    if (cascades == null)
        return false;
    for (CascadeType cas : cascades) {
        if ((cas == CascadeType.ALL) || (cas == CascadeType.MERGE)
                || (cas == CascadeType.PERSIST)
                || (cas == CascadeType.REMOVE)) {
            return true;
        }
    }
    return false;
}
 
Example 5
Source File: SCCSubscription.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the SUSE Products
 * @return the SUSE Products
 */
@ManyToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinTable(name = "suseSCCSubscriptionProduct",
    joinColumns = @JoinColumn(name = "subscription_id"),
    inverseJoinColumns = @JoinColumn(name = "product_id"))
public Set<SUSEProduct> getProducts() {
    return products;
}
 
Example 6
Source File: Group.java    From MiniWeChat-Server with MIT License 4 votes vote down vote up
@ManyToMany(targetEntity = User.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinTable(name = "group_members", joinColumns = @JoinColumn(name = "group_id"), inverseJoinColumns = @JoinColumn(name = "user_id"))
public List<User> getMemberList() {
	return memberList;
}
 
Example 7
Source File: GroupTaskAccessDO.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE})
@JoinColumn(name = "group_id")
public GroupDO getGroup()
{
  return group;
}
 
Example 8
Source File: GroupDO.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
@ManyToMany(targetEntity = org.projectforge.user.PFUserDO.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE}, fetch = FetchType.EAGER)
@JoinTable(name = "T_GROUP_USER", joinColumns = @JoinColumn(name = "GROUP_ID"), inverseJoinColumns = @JoinColumn(name = "USER_ID"))
public Set<PFUserDO> getAssignedUsers()
{
  return assignedUsers;
}
 
Example 9
Source File: Control.java    From zxl with Apache License 2.0 4 votes vote down vote up
@ManyToMany(fetch = FetchType.EAGER, targetEntity = Role.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JsonIgnore
@XmlTransient
public Set<Role> getRoles() {
	return roles;
}
 
Example 10
Source File: Role.java    From zxl with Apache License 2.0 4 votes vote down vote up
@ManyToMany(mappedBy = "roles", targetEntity = Resource.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JsonIgnore
@XmlTransient
public Set<Resource> getResources() {
	return resources;
}
 
Example 11
Source File: Role.java    From zxl with Apache License 2.0 4 votes vote down vote up
@ManyToMany(targetEntity = User.class, mappedBy = "roles", cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JsonIgnore
@XmlTransient
public Set<User> getUsers() {
	return users;
}
 
Example 12
Source File: Role.java    From zxl with Apache License 2.0 4 votes vote down vote up
@ManyToMany(targetEntity = Control.class, mappedBy = "roles", cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JsonIgnore
@XmlTransient
public Set<Control> getControls() {
	return controls;
}
 
Example 13
Source File: User.java    From zxl with Apache License 2.0 4 votes vote down vote up
@ManyToMany(fetch = FetchType.LAZY, targetEntity = Role.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JsonIgnore
@XmlTransient
public Set<Role> getRoles() {
	return roles;
}
 
Example 14
Source File: User.java    From MiniWeChat-Server with MIT License 4 votes vote down vote up
@ManyToMany(targetEntity = Group.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinTable(name = "group_members", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "group_id"))
   public List<Group> getGroups() {
	return groups;
}
 
Example 15
Source File: WeixinPhotoEntity.java    From jeewx with Apache License 2.0 4 votes vote down vote up
@ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE, CascadeType.REFRESH},fetch = FetchType.LAZY)
@JoinColumn(name = "photo_album_id")
public WeixinPhotoAlbumEntity getAlbum() {
	return album;
}
 
Example 16
Source File: TFinanceFilesEntity.java    From jeewx with Apache License 2.0 4 votes vote down vote up
@ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE, CascadeType.REFRESH},fetch = FetchType.LAZY)
@JoinColumn(name = "financeId")
public TFinanceEntity getFinance() {
	return finance;
}
 
Example 17
Source File: PhoneBookEntry.java    From livingdoc-core with GNU General Public License v3.0 4 votes vote down vote up
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "PHONEBOOK_ID")
public PhoneBook getPhoneBook() {
    return phoneBook;
}
 
Example 18
Source File: State.java    From livingdoc-core with GNU General Public License v3.0 4 votes vote down vote up
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "COUNTRY_ID")
public Country getCountry() {
    return country;
}
 
Example 19
Source File: GroupTaskAccessDO.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE}, targetEntity = TaskDO.class)
@JoinColumn(name = "task_id")
public TaskDO getTask()
{
  return task;
}
 
Example 20
Source File: Document.java    From livingdoc-core with GNU General Public License v3.0 4 votes vote down vote up
@ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
@JoinColumn(name = "REPOSITORY_ID")
public Repository getRepository() {
    return this.repository;
}