7.1 JDO versus JDBC


Put in its simplest form, JDO can be used to build any Java application that needs to access data stored in a datastore, whatever the architecture of the Java application. To this extent, JDO and JDBC can be viewed as competing ways of accessing persistent data from Java. However, the difference between JDO and JDBC lies in JDO's object perspective.

For data-centric applications, whose main purpose is to store and retrieve record-oriented data, JDBC is likely the best tool for the job. Record-oriented data can easily be mapped directly to a relational model, and an application can leverage the power of SQL for ad hoc queries and data access. The focus is on the data.

For object-centric applications, whose main purpose is to process a complex graph or hierarchy of interrelated data, JDO is likely the best tool for the job. An object model can be used to represent the complex graph or hierarchy of interrelated data that the application can navigate through to complete its processing. The focus is on the object model.

Simply put, JDBC is for applications that need to think of data as relations (tables, rows, and columns ), and JDO is for applications that need to think of data as interrelated objects. Figure 7-1 shows the difference in structure between object-centric and data-centric applications.

Figure 7-1. An object-oriented application versus a relational-oriented application.

graphics/07fig01.gif



Core Java Data Objects
Core Java Data Objects
ISBN: 0131407317
EAN: 2147483647
Year: 2003
Pages: 146

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net