The starting point for making a Java Entity class model is an OO class model with derived inverse reference properties like the one discussed above (in Figure 7.4), which we present here again, for convenience:

Notice that the model contains two derived inverse reference properties: `Publisher`

::`/publishedBooks`

and `Author`

::`/authoredBooks`

. Each of them is linked to a master property, from which it is derived, by means of an *inverse-of* constraint. Consequently, each of them represents a pair of mutually inverse reference properties corresponding to a bidirectional association.

We now show how to derive a Java Entity class model from the OO class model:

Turn each class into a

`«Java Entity»`

class, making all properties private.Replace the platform-independent datatype names of the OO class model with corresponding Java datatype classes (Integer, Float, etc.).

Add a

`«get/set»`

stereotype to all non-derived properties for indicating that they need getters and setters.Add a

`«get»`

stereotype to all derived properties for indicating that they need getters, only.For any reference property, depending on the functionality type of the association represented by it, add a corresponding keyword as property modifier. For the given OO class model, add the following property modifiers:

`oneToMany`

to the derived reference property`Publisher`

::`/publishedBooks`

,`manyToOne`

to the reference property`Book`

::`publisher`

`manyToMany`

to the reference property`Book`

::`authors`

`manyToMany`

to the derived reference property`Author`

::`/authoredBooks`

For any derived reference property designated as the inverse of another reference property, replace its {inverse of ...} property modifier with a corresponding {mappedBy="..."} property modifier.

Create the required property constraint check operations.

Create an add, and a remove operation for each multi-valued property.

This leads to the following Java Entity class model: