本文整理汇总了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;
}
示例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;}
示例3: getView
@OneToOne(cascade = CascadeType.PERSIST)
@JoinColumns ({
@JoinColumn(name = "view" , referencedColumnName = "dataid" ),
@JoinColumn(name = "creater" , referencedColumnName = "creater" )
})
public TopicView getView() {
return view;
}
示例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;
}
示例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;
}
示例6: getMedia
@XmlTransient
@LazyCollection(LazyCollectionOption.EXTRA)
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "albums", cascade=CascadeType.PERSIST)
public List<Media> getMedia() {return media;}
示例7: getCidade
@NotNull
@ManyToOne(cascade = CascadeType.PERSIST, optional = false)
@JoinColumn(foreignKey = @ForeignKey(name = "fk_endereco_to_cidade"))
public Cidade getCidade() {
return cidade;
}
示例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;
}
示例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;
}
示例10: getAllocator
@ManyToOne(fetch = FetchType.EAGER,cascade={CascadeType.MERGE,CascadeType.PERSIST})
@JoinColumn(name = "allocator")
public Allocator getAllocator() {
return this.allocator;
}
示例11: getAcctUserInfo
@OneToMany(mappedBy="acctUser",cascade = { CascadeType.PERSIST ,CascadeType.ALL})
public Set<AcctUserInfo> getAcctUserInfo() {
return acctUserInfo;
}
示例12: getTopicAd
@OneToMany(mappedBy="topic",cascade = { CascadeType.PERSIST ,CascadeType.ALL})
public Set<TopicAd> getTopicAd() {
return topicAd;
}
示例13: getChildren
@OneToMany(mappedBy = "parent",
fetch = FetchType.EAGER,
cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE, CascadeType.REFRESH })
public List<MethodAccessAnnotationTestBean> getChildren() {
return childBeans;
}
示例14: getProcessInstance
@ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE })
public ProcessInstance getProcessInstance() {
return processInstance;
}
示例15: getActivityDefinition
@ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE })
public ActivityDefinition getActivityDefinition() {
return activityDefinition;
}