James P.
James P.

Reputation: 19617

JPA - Removing entities

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/

Upvotes: 1

Views: 274

Answers (1)

Bozho
Bozho

Reputation: 597362

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

Upvotes: 2

Related Questions