试图更新我的实体时,我有以下问题引用:休眠 - 与级联集合=”全删除,孤儿”不再由所拥有的实体实例
"A collection with cascade=”all-delete-orphan” was no longer referenced by the owning entity instance".
我有一个父实体,它有一些子实体的Set<...>
。当我尝试更新它时,我将所有引用设置为此集合并进行设置。
下面的代码代表我的映射:
@OneToMany(mappedBy = "parentEntity", fetch = FetchType.EAGER)
@Cascade({ CascadeType.ALL, CascadeType.DELETE_ORPHAN })
public Set<ChildEntity> getChildren() {
return this.children;
}
我试图清理设置< ..>只,按照这样的:How to "possible" solve the problem,但没有奏效。
如果您有任何想法,请让我知道。
谢谢!
https://sysdotoutdotprint.wordpress.com/2017/01/25/hibernate-a-collection-with-cascadeall-delete-orphan-was-no-longer-referenced-by-the -owning-entity-instance/ – mel3kings 2017-01-25 13:43:33
@m el3kings,您提供的链接不再有效。 – Opal 2018-02-27 09:32:53
@Opal http://sysdotoutdotprint.com/technologies/java/12 – mel3kings 2018-03-02 09:49:29