Our starting point for making a Java Entity class model is the following OO class model:
This model contains, in addition to the single-valued reference property Book
::publisher
representing the unidirectional many-to-one association Book-has-Publisher, the multi-valued reference property Book
::authors
representing the unidirectional many-to-many association Book-has-Author.
Recall that we obtain a Java Entity class, like Author
, from the corresponding class in the OO class model, by (1) making all properties private, (2) using Java datatype classes, (3) adding public getters and setters, (4) adding a toString
function, (5) adding the data storage methods create
, retrieve
, update
and delete
:
In the Java Entity class model, any reference property specified in the OO class model is annotated with the functionality type of the association represented by it. In our example, we annotate the reference property authors
in the Entity class Book
with manyToMany
: