fernando1979
fernando1979

Reputation: 1947

Detach JPA entity, detaches associated entities?

Hy,

I have a JPA entity which I get from database and this entity has a few associations which are retrieved too from database; these associated entities are eager retrieved. My questions is:

  1. If I detach the main entity (with EntityManager detach method) which have these associations, are these associated entities detached too?

Thanks

Upvotes: 1

Views: 96

Answers (1)

DuncanKinnear
DuncanKinnear

Reputation: 4643

Only associations which have cascade=CascadeType.DETACH will be detached when you detach an Entity.

Upvotes: 1

Related Questions