首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

JPA 级联更新往孤子

2013-11-15 
JPA 级联更新去孤子class A{private SetB bs new HashSetB()@OneToMany(cascade CascadeType.ALL

JPA 级联更新去孤子
class A{ private Set<B> bs = new HashSet<B>();@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "flowNode", orphanRemoval = true)@OrderBy(clause = "id")public Set<B> getBs() {return bs;}}

?

调用操作代码:

A a = new A();Set<B> bs = new HashSet<B>();bs.add(...)a.getBs().clear();a.getBs().addAll(bs);

?

?

?

热点排行