Dreamer
Dreamer

Reputation: 7551

JPA: How to make sure the @Embeddable is managed?

Is there any code or API should call to make current entity's @Embeddable field to be managed? Or is it supposed to be default managed by its parent?

Upvotes: 1

Views: 100

Answers (1)

V G
V G

Reputation: 19002

The Embeddable objects are not directly manageable, as they do not have a persistent identity by themselves. As you guessed, the entity containing the embeddable is manageable, meaning that the EntityManager tracks the changes of the Emebeddable instance through the Entity instance.

This means, making the parent entity managed, you will make also the Embeddable instance managed.

Upvotes: 2

Related Questions