Introducing ORM, O/RM, and O/R mapping

ORM is the process of persisting objects in a relational database such as RDBMS. ORM bridges the gap between object and relational schemas, allowing object-oriented applications to persist objects directly without having the need to convert objects to and from a relational format.

ORM creates a virtual object database that can be accessed via a programming language and simplifies the data access layer of complex enterprise applications using a relational database as its persistence store. ORM simplifies the job of implementing the data access layer for enterprise applications implemented using object-oriented programming languages and the relational database as its persistence store, as illustrated by the following figure:

Introducing ORM, O/RM, and O/R mapping

ORM is about mapping object representations to JDBC statement parameters and in turn mapping JDBC query results back to object representations. Database columns are mapped to the instance fields of domain objects or JavaBeans' properties.

Usually, ORM doesn't work at the SQL level but rather refers its own Object Query Language, which gets translated into SQL at runtime. The mapping information is kept as metadata (in XML files or as annotations on mapped objects), which defines how to map a persistent class and its fields into database tables and theirs columns. The database dialect is configured to address database specifics. For example, ID generation is configured in the metadata and is automatically translated into sequences or autoincrement columns.

Until now, we have understood how ORM implementations in Java help us to quickly implement a reliable data access layer to concentrate on other tiers of the application. In the next section, we will understand the features of Hibernate and their uses in a Spring application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.207.145