Hi, I have this kind of entities:
Document | n .. to ..1 | DocumentType | 1 .. to .. n | PropertyType | 1 .. to .. n | DocumentProperty
I simply try to remove a document like: entityManager.remove(document);
but an error is firing:
16:45:51,499 ERROR [[Seam Resource Servlet]] Servlet.service() for servlet Seam Resource Servlet threw exception javax.persistence.EntityNotFoundException: deleted entity passed to persist: [up.docstore.PropertyType#]
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 remove CascadeType.PERSIST all it's working. But i need it there and also i need it EAGERLY.
Does anyone know other solution?
Edit: removed DELETE_ORPHAN cascade, but still the same problem.