Java – the deleted entity is passed to the persistent exception

I have such entities:

I'm just trying to delete a file, such as entitymanager Remove (file);

However, an error occurred:

The problem seems to come from here:

@OneToMany(mappedBy = "documentType",cascade = {CascadeType.ALL},fetch = FetchType.EAGER)
@ForeignKey(name = "FK_DOCUMENT_TYPE__PROPERTY_TYPE")
@Sort(type = SortType.NATURAL)
private SortedSet<PropertyType> propertyTypes = new TreeSet<PropertyType>();

If I delete cascadetype Persist all its work But I need it there, and I need it easy

Does anyone know other solutions?

Edit: delete_ Orphan cascading, but still the same problem

Solution

Solution:

Why this solution?

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>