开发者

JPA - Removing entities

开发者 https://www.devze.com 2022-12-25 17:55 出处:网络
I have a Story entity with the following associations: Story <1-*> Chapte开发者_运维问答r Story <1-*> Comment

I have a Story entity with the following associations:

What is the correct way of removing this entity and handling the all the entities that is referring to? Is there some shorthand way of specifying that associated entities must be handled automatically or is the @PreRemove annotation mentioned in the article below a valid way of achieving this?

http://blog.xebia.com/2009/04/09/jpa-implementation-patterns-removing-entities/


Depending on what you want to do - delete the remaining entities or retain then, you can use the cascade attribute of the @*To* annotations.

0

精彩评论

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