开发者

Removing associated entity JPA (or delete orphan equivalent in EclipseLink)

开发者 https://www.devze.com 2022-12-23 17:16 出处:网络
I have a question regarding JPA persistence in Glassfish. Situation: I have a Supplier class that has a 1:n bidirectional relation to SupplierAddress.

I have a question regarding JPA persistence in Glassfish. Situation: I have a Supplier class that has a 1:n bidirectional relation to SupplierAddress. I would like to have the following behaviour: If I remove the SupplierAddress object from 开发者_如何学编程the List in the Supplier object and update it via the merge(supplierobject), the SupplierAddress tupel/object should be deleted. Is there an annotation do configure it like this or do I have to delete it manually. Any help would be very appreciated.

Greetings

Marcel


Not in JPA.

In Hibernate this is called "delete orphan". Since you work with EclipseLink, I found something like an equivalent:

@PrivateOwned - If you remove the reference to a target from a source, then delete the target.

0

精彩评论

暂无评论...
验证码 换一张
取 消