Performance Issues

One of the biggest problems with using objects and a relational database is that you access data differently with objects. For example, suppose you want to make a list of all people who live in Georgia. In the object world, you loop through your container of people, call getAddress on each person and then call getState on the address object to see whether it's 'GA'.

In the relational world, you do a query like this:

SELECT person.* from person, address
where address.person_id = person.person_id
    and address.state = 'GA'

Both of these techniques are reasonably efficient. Now, when you use an object-to-relational mapping, things get ugly. Once again, you fetch a container of people and you call getAddress. This time, however, ...

Get Special Edition Using Java™ 2 Enterprise Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.