JPA @Embedded and @Embeddable
Is there an easy way to define a "composite" association between two JPA1 entities which will create one as an @Embeddable object to its "parent"? In an effort to duplicate what the example class diagram contains (UML Lab Shop Example), I tried to "Edit Association" from the default "Composition" association line to remove "Navigable" option so that the association mimicked that found in the example, but this still did not produce any @Embeddable object related to the @Entity associated.
Comments
That's simple - you just have to apply the "PersistentPart" stereotype on the entity: select the entity and choose the stereotype in the "Stereotypes" tab in the properties view. This stereotype has the UML Property "Part Type". "Embeddable" is the default value of that property.
The Association itself must be a uni-directional composition (to 1), as you already descriped. I attached a screenshot of how the complete pattern should look like.
Best regards
Manuel
I don't see the screenshot attached, but I added the Stereotype and it worked as you described. Thanks for the response!
-B