读书人

JPA 级联更新往孤子

发布时间: 2013-11-15 22:28:15 作者: rapoo

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);

?

?

?

读书人网 >开源软件

热点推荐