當前位置: 首頁>>代碼示例>>Java>>正文


Java CascadeType.PERSIST屬性代碼示例

本文整理匯總了Java中javax.persistence.CascadeType.PERSIST屬性的典型用法代碼示例。如果您正苦於以下問題:Java CascadeType.PERSIST屬性的具體用法?Java CascadeType.PERSIST怎麽用?Java CascadeType.PERSIST使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.persistence.CascadeType的用法示例。


在下文中一共展示了CascadeType.PERSIST屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: needsToCascade

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;
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:36,代碼來源:ReflectiveClone.java

示例2: getAlbums

@ManyToMany(fetch=FetchType.LAZY, cascade=CascadeType.PERSIST)
@JoinTable(name = "album_media", 
		   joinColumns = { 
		@JoinColumn(name = "media_id", nullable = false, updatable = false) }, 
inverseJoinColumns = { 
		@JoinColumn(name = "album_id", nullable = false, updatable = false) })    
public List<Album> getAlbums() {return albums;}
 
開發者ID:awslabs,項目名稱:aws-photosharing-example,代碼行數:7,代碼來源:Media.java

示例3: getView

@OneToOne(cascade  =  CascadeType.PERSIST)
   @JoinColumns ({
       @JoinColumn(name  =   "view" , referencedColumnName  =   "dataid" ),
       @JoinColumn(name  =   "creater" , referencedColumnName  =   "creater" )
   })
public TopicView getView() {
	return view;
}
 
開發者ID:uckefu,項目名稱:uckefu,代碼行數:8,代碼來源:TopicComment.java

示例4: getComments

/**
 * Get all comments for current blog entry.
 * 
 * @return List of all comments for current blog entry.
 */
@OneToMany(mappedBy = "blogEntry", fetch = FetchType.LAZY,
        cascade = CascadeType.PERSIST, orphanRemoval = true)
@OrderBy("postedOn")
public List<BlogComment> getComments() {
    return comments;
}
 
開發者ID:fgulan,項目名稱:java-course,代碼行數:11,代碼來源:BlogEntry.java

示例5: getEntries

/**
 * Gets all blog entries for which current user is author.
 * 
 * @return List of current user blog entries.
 */
@OneToMany(mappedBy = "creator", fetch = FetchType.LAZY,
        cascade = CascadeType.PERSIST, orphanRemoval = true)
@OrderBy("createdAt")
public List<BlogEntry> getEntries() {
    return entries;
}
 
開發者ID:fgulan,項目名稱:java-course,代碼行數:11,代碼來源:BlogUser.java

示例6: getMedia

@XmlTransient
@LazyCollection(LazyCollectionOption.EXTRA)  
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "albums", cascade=CascadeType.PERSIST)    
public List<Media> getMedia() {return media;}
 
開發者ID:awslabs,項目名稱:aws-photosharing-example,代碼行數:4,代碼來源:Album.java

示例7: getCidade

@NotNull
@ManyToOne(cascade = CascadeType.PERSIST, optional = false)
@JoinColumn(foreignKey = @ForeignKey(name = "fk_endereco_to_cidade"))
public Cidade getCidade() {
	return cidade;
}
 
開發者ID:marcelothebuilder,項目名稱:webpedidos,代碼行數:6,代碼來源:Endereco.java

示例8: getEstado

@NotNull
@ManyToOne(cascade = CascadeType.PERSIST, optional = false)
@JoinColumn(name = "estado_codigo", nullable = false, foreignKey = @ForeignKey(name = "fk_cidade_to_estado"))
public Estado getEstado() {
	return estado;
}
 
開發者ID:marcelothebuilder,項目名稱:webpedidos,代碼行數:6,代碼來源:Cidade.java

示例9: getCategoria

@NotNull
@ManyToOne(cascade = CascadeType.PERSIST, optional = false)
@JoinColumn(name = "categoria_id", nullable = false, foreignKey = @ForeignKey(name = "fk_produto_to_categoria"))
public Categoria getCategoria() {
	return categoria;
}
 
開發者ID:marcelothebuilder,項目名稱:webpedidos,代碼行數:6,代碼來源:Produto.java

示例10: getAllocator

@ManyToOne(fetch = FetchType.EAGER,cascade={CascadeType.MERGE,CascadeType.PERSIST})
@JoinColumn(name = "allocator")
public Allocator getAllocator() {
	return this.allocator;
}
 
開發者ID:AuScope,項目名稱:igsn30,代碼行數:5,代碼來源:Registrant.java

示例11: getAcctUserInfo

@OneToMany(mappedBy="acctUser",cascade = { CascadeType.PERSIST ,CascadeType.ALL})
public Set<AcctUserInfo> getAcctUserInfo() {
	return acctUserInfo;
}
 
開發者ID:muzili90,項目名稱:SpringBBS,代碼行數:4,代碼來源:AcctUser.java

示例12: getTopicAd

@OneToMany(mappedBy="topic",cascade = { CascadeType.PERSIST ,CascadeType.ALL})
public Set<TopicAd> getTopicAd() {
	return topicAd;
}
 
開發者ID:muzili90,項目名稱:SpringBBS,代碼行數:4,代碼來源:Topic.java

示例13: getChildren

@OneToMany(mappedBy = "parent",
           fetch = FetchType.EAGER,
           cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE, CascadeType.REFRESH })
public List<MethodAccessAnnotationTestBean> getChildren() {
    return childBeans;
}
 
開發者ID:ArneLimburg,項目名稱:jpasecurity,代碼行數:6,代碼來源:MethodAccessAnnotationTestBean.java

示例14: getProcessInstance

@ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE })
public ProcessInstance getProcessInstance() {
    return processInstance;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:4,代碼來源:ActivityState.java

示例15: getActivityDefinition

@ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE })
public ActivityDefinition getActivityDefinition() {
    return activityDefinition;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:4,代碼來源:ActivityState.java


注:本文中的javax.persistence.CascadeType.PERSIST屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。