Home > Articles > Data

  • Print
  • + Share This
This chapter is from the book

Using Object-Relational Mapping Tools

Most business applications access data in relational databases. However, the relational model is designed for efficiently storing and retrieving data, not for the object-oriented model often used for business applications.

As a result, new object-relational mapping (ORM) tools are becoming popular with many business application developers. Hibernate and Java Persistence API (JPA) are such tools for the Java environment, and NHibernate and ADO.NET Entity Framework are such tools for the .NET environment.

Object-relational mapping tools map object-oriented programming objects to the tables of relational databases. When using relational databases with objects, typically, an ORM tool can reduce development costs because the tool does the object-to-table and table-to-object conversions needed. Otherwise, these conversions must be written in addition to the application development. ORM tools allow developers to focus on the business application.

From a design point of view, you need to know that when you use object-relational mapping tools you lose much of the ability to tune your database application code. For example, you are not writing the SQL statements that are sent to the database; the ORM tool is creating them. This can mean that the SQL statements could be more complex than ones you would write, which can result in performance issues. Also, you don’t get to choose the API calls used to return data, for example, SQLGetData versus SQLBindCol for ODBC.

To optimize application performance when using an ORM tool, we recommend that you tune your database driver appropriately for use with the database your application is accessing. For example, you can use a tool to log the packets sent between the driver and the database and configure the driver to send a packet size that is equal to the packet size of that configured on the database. See Chapter 4, “The Environment: Tuning for Performance,” for more information.

  • + Share This
  • 🔖 Save To Your Account