-
Book Overview & Buying
-
Table Of Contents
EJB 3 Developer Guide
By :
We will modify our application again and introduce some more object-relational mapping annotations. Specifically we will cover the @Embedded, @Embeddable, @Enumerated, and @MapKey annotations.
First we decide to embed the Referee entity within the Customer entity. An embedded Referee entity shares the identity of the owning Customer entity. A Referee entity cannot exist on its own without a corresponding Customer entity. Such a Referee entity cannot be independently persisted, it is persisted by default whenever the owning Customer entity is persisted. However, we still map a Referee object onto a relational database in the usual manner.
We also decide to add an enumerated type, gender, as a Customer attribute.
To indicate an entity is embedded EJB 3 provides two annotations: @Embedded and @Embeddable. @Embedded is used within the owning entity and @Embeddable within the embedded entity. Below is the modified version of the Customer entity:
@Entity public...
Change the font size
Change margin width
Change background colour