- Introduction
- JDBC Design
- The Relational Database
- Java and Relational Databases
- Object Databases
- Object-Relational Mapping Tools and JDO
- Relational Databases and SQL
- The JDBC API
- Programming for Today
- Java Design Patterns
- Summary
- Coming Up Next
Object-Relational Mapping Tools and JDO
An interesting alternative to both JDBC and object databases is the Java Data Object (JDO) API. JDO provides a vendor-neutral facility for persisting Java objects. Like the object database, this represents a natural, object-oriented approach to working with data in a Java application. Issues such as transaction support and query language capabilities are provided for in the JDO specification. Since the JDO specification is not specific to any vendor, a developer could create a Java application using JDO with SQL-Server and port it to use Oracle or DB2 without needing to change any code.
JDO is not necessarily a replacement for JDBC but is instead a complementary approach. JDO will provide for the OR-mapping between the object definitions of Java and the entities and attributes of the relational database, and JDBC will provide the low-level access to the database. JDO and JDBC could be used together in an application with JDO being used to manage a large number of persistent objects and JDBC being used to provide access to complex, legacy relational databases that prove too difficult and expensive to map into objects.
Limitations of OR-Mapping and JDO
On the surface, JDO and OR-mapping provide a very attractive approach, but there are potential issues. Data queries can become very complex even for a relatively simple application. The nonprocedural nature of SQL allows complex queries to be expressed relatively simply. It remains to be seen whether or not the query language of JDO will provide this expressive elegance.
There is significant technology and experience that relational databases have accumulated over the past 20 or more years that provide performance and usability benefits for the application developer. Additionally, a significant amount of existing data that Java applications must access is in relational databases.