JPOX
JPOX
 Project  |  Ver 1.1  |  Ver 1.2  |  JDO  |  JPA  |  Guides  |  Tools
1.1 | Preparation | O/R Mapping | Runtime | Extensions | Developer
O/R Mapping
Relationships
O/R Mapping
Persistence Process ORM Runtime

We have now defined which classes and fields will be persisted. Since we are persisting to an RDBMS datastore we now need to define how the persistence of our classes/fields matches up to the schema of the datastore, often termed Object-Relational Mapping (ORM) since we are mapping from objects to a relational datastore.

The design of the O/R persistence layer of an application can be approached in 3 ways.

  • Forward Mapping - Here you have a set of model classes, and want to design the datastore schema that will store represent these classes.
  • Reverse Mapping - Here you have an existing datastore schema, and want to design your model classes to represent this schema.
  • Meet in the Middle Mapping - Here you have a set of model classes and you have an existing datastore schema, and you want to match them up.

JPOX can be used in all of these modes, though provides significant assistance for Forward Mapping cases. In particular, when using this mode you can use the JPOX SchemaTool to generate the datastore schema, based on a set of input classes and MetaData files. It should be noted though that JPOX SchemaTool also provides modes of operation for updating an existing schema, and hence can also be used for Meet in the Middle Mapping. Additionally, it can be used as a validation mechanism when designing your system in Reverse Mapping mode, where it will inform you of inconsistencies between your classes and your datastore schema.