Java Reference
In-Depth Information
Presentation
Tier
POJO Façade
Domain Model
PendingOrder
Restaurant
PendingOrder
Repository
Restaurant
Repository
Object /Relational Mapping Framework
Figure 4.3
The relationship between the ORM
framework and the rest of the application
Database
interfaces or call any ORM framework API s. Later you will see that the repositories
are the only domain model classes that call the ORM framework API to create,
find, and delete persistent objects.
An API for creating, loading, and deleting objects
In addition to providing a declarative mapping mechanism, an ORM framework
provides an API for creating, loading, and deleting persistent objects. These API s
are invoked by the domain model repositories, as shown in figure 4.3. A reposi-
tory instantiates a persistent object using new and calls an ORM framework API
method to save it in the database. It loads an object by calling an ORM framework
API method, with a class and object ID as arguments. If the object is not already
loaded, the framework queries the database and loads the object. The framework
will also lazily load an object when the application navigates to it. An application
deletes a persistent object by calling the ORM framework API , which deletes it
from the database.
 
Search WWH ::




Custom Search