Chapter 7. JDO Persistence

Those who feel that liberation from tradition is a good thing rejoice at this change, while those who fear the results lament the loss of roots.

David Kolb, The Critique of Pure Modernity

JDBC provides your application with direct access to a relational data store. Though JDBC tries to objectify the data store using objects that represent relational database concepts, it does not provide an object-oriented picture of your problem domain. Your job in JDBC programming is to use information from those database objects to build an OO picture of your problem domain. This task is the problem of object-relational mapping we talked about in Chapter 4.

Also in Chapter 4, I introduced the concept of the data access object pattern. Using this pattern, business objects delegate their persistence to something else called a data access object. Chapter 4 then showed you how to use JDBC to build data access objects. Chapter 6 showed you how to use the data access object pattern in an EJB system to provide JDBC-based persistence.

You do not need to write the persistence layer for this pattern to be valid. EJB CMP “delegates” its persistence operations to the container. EJB CMP, however, is not the only automated persistence option for Java architects and developers. This chapter covers the major standard option to EJB CMP, the Java Data Objects (JDO) specification. If you are not familiar with this specification, Chapter 12 provides a tutorial to introduce you to JDO programming. ...

Get Java Database Best Practices 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.