ODMG: The Industry Standard for Java Object Storage
By Douglas Barry and David Jordan
Component Strategies - September 1998
Java has gained market acceptance with breath-taking speed – even as developers have become increasingly reluctant to use proprietary interfaces. The Object Data Management Group (ODMG) Binding for Java, supported on both relational and object database engines, is the best database technology available today for Java object storage. Indeed, Sun has endorsed the ODMG Java Binding and developed its own ODMG-compliant product, called Java Blend, which implements the Java Binding on relational databases.
In the Java environment, rudimentary object storage capability can be implemented with object serialization. Objects to be stored are organized into a network whose root object is declared to be serializable. Any object that can be referenced by a persistent object is itself considered to be persistent and therefore a member of the network. This notion is referred to as persistence by reachability. Members of the object network are converted to a byte stream for storage in a flat file. The object serialization approach is suitable, however, for only the most basic persistence needs, since each time that a member of the object network is stored, the entire byte stream containing all objects in the network must be serialized and stored. The reverse process occurs every time that a persistent object is accessed. Moreover, object serialization lacks fundamental database capabilities, like transactions, that are required for enterprise applications.
A far more powerful solution is the ODMG Binding for Java. It provides complete database storage capabilities that make it easy for application developers to store objects in a wide range of compliant relational, object-relational and object databases directly from Java, without concern for the underlying storage engine. The tight integration of application and database programming into a single environment makes the ODMG Java Binding easy for Java developers to pick up and begin using immediately, freeing them to invest their time in application development rather than in database programming. By using the Java Binding, developers eliminate the problems of writing application-to-database mapping code or learning a specialized database programming language.
Since the ODMG Java Binding is available for both relational and object databases, it offers a standard Java object storage interface that protects users from the "single-source corner" by ensuring Java application portability. The implementation independence of the ODMG Java Binding gives users the freedom to choose from a variety of back-ends and the flexibility to retarget to new ones easily as their needs evolve. The support of multiple vendors for the ODMG Java Binding also reduces development risk. Applications built on the Java Binding are portable across a variety of implementations, and it is accordingly easier to find development staff that is experienced with the interface. When multiple vendors are supporting the same interface and competing for business, licensees have greater leverage in contract negotiations and vendors have powerful incentives to provide differentiation and greater added value. The following table lists products that presently support the ODMG Java Binding.
|Sun Microsystems||Java Blend|
|Object Design||ObjectStore, PSE for Java|
|POET||POET Object Server|
|Ardent Software||O2 System|
Table. Companies providing ODMG Java-compatible object storage products
Working with the ODMG Java Binding
The ODMG Java Binding supports database transparency. The JavaThe Java application classes actually define the database schema. Since the database software understands the application Java classes, it can provide a direct mapping from the database into a cache it manages in the application memory. As the application navigates among related objects, the ODMG data storage transparently maps them into the cache. The database tracks Java objects in the cache as they are modified by the application, and then writes them back to the database at transaction commit time. This client cache management implies a high degree of coupling between the database and the application, and hence standardization is very important.
The Java Binding integrates seamlessly into the Java environment in a manner that Java programmers will find at once intuitive and natural, because they access and manipulate databases using Java. The Java Object Manipulation Language (OML) is a set of classes and other constructs that are added to the Java environment to support the ODMG object model with collections, transactions and databases. An essential aspect of the Java Binding is that it provides these OML capabilities without altering the semantics of the Java language. Instances of existing classes can be made persistent without changes to source code. In the ODMG Java Binding, persistence is achieved through reachability, so that once a transaction is committed, any objects that can be reached from root objects in the database are automatically made persistent in the database.
The developer begins by specifying to a schema capture tool which Java classes are to be persistent. Instances of these persistent classes are then automatically stored in the database. The ODMG specification allows for schema capture tools to process code either at the source or bytecode level, depending upon the vendor’s specific implementation. The developer must also use the ODMG-compliant collection classes provided by the vendor. A Database class is used to open and close databases and a Transaction class is used to begin and commit transactions. The ODMG Java Binding understands Java classes and automatically maps persistent instances between the database and memory.
A powerful component of the ODMG Binding for Java is its Object Query Language (OQL), which provides fast and efficient object-querying capability from Java. The syntax of OQL is based on the SQL-92 SELECT syntax with extensions to support objects, including object identity, complex objects, path expressions, operation invocation and inheritance. In SQL, data definition and manipulation are also part of the SQL language. In ODMG, data definition and manipulation are in Java with OQL handling queries. Java OQL is completely natural to Java programmers, since they get back Java objects, rather than tables. Also, since OQL is implemented completely in the Java language, queries can invoke methods and methods may call queries in a seamless, flexible working environment.
ODMG on Application Servers
The ODMG Java Binding is ideally suited to three-tier computing or multi-tier computing. In the conventional client/server model, a client application made a request of a server, which was responsible for both business logic and database functions. This approach does not work well in the web-based world. Application developers working in Java need to be able to store Java application objects in a fast and direct manner. The client/server model quickly breaks down.
In the three-tier model, the user interacts with a client or thin client (e.g., a web browser) which provides a GUI. Rather than residing in the database, application logic may be distributed between the application server and the client in the manner the best serves the application design. The application server manages Java application objects and provides intelligent local object caching. Data is ultimately stored in a relational or other back-end database.
By now, it should now be clear why the ODMG Java Binding fits perfectly into a three-tier architecture and to distributed object technologies such as Enterprise Java Beans. The Java Binding runs on the application server, where it provides fast, efficient Java object storage for the application. In addition, web-based applications are typified by large numbers of concurrent users, and the ODMG Java Binding’s transaction model can support simultaneous threads, each within their own transactions.
The Java Binding’s database independence insulates Java programmers from underlying database implementation details and enables them to concentrate on application development. At the same time, database independence allows application servers to be placed in front of one or more relational, object-relational or object databases. Backend database access is minimized through the use of intelligent object caching at the application server level. Where the back-end is a relational database, the problem of decomposing and recomposing objects for table-based storage can be handled at the application server, rather than burdening the back-end.
ODMG Adds Support for JDK 1.2 Collection Classes
Collections are fundamental to any application development, since they are used to model relationships among objects. To be useful for most applications, they must be persistence-capable. Until the release of JDK 1.2 by Sun, the "out-of-the-box" Java collection classes were limited to Vector and Hashtable, which was insufficient for complete applications, which require collections such as lists and sets. Third party collections were available, like the Java Generic Library (JGL) from Objectspace. In JDK 1.2, JavaSoftSun added a set of collection interfaces and classes, which are now also available under a different package hierarchy for JDK 1.1 environments. Most developers will choose to use the standard Sun-provided collections, since they are guaranteed to be ubiquitous and free of additional license fees.
Clearly, the availability of standard collection interfaces driven by Sun directly benefits the user base and will result in its rapid expansion, given that the same ODMG interfaces are available on a variety of relational and object storage technologies. Developers will use the collection classes throughout their object models and tools like Java application frameworks will assume their availability. As a result, application models built with ODMG will plug directly into these frameworks, rapidly increasing the use of ODMG Java object storage products.
A wide range of powerful CASE and GUI tools is available for relational databases. Historically, however, the object storage market has been so much smaller and proprietary that tool vendors have been unable to justify supporting the technology. With the advent of the ODMG Java Binding and the JDK 1.2 collections, vendors can support both technologies using the same interface. CASE tool vendors can support the Sun collection interfaces in their UML modeling environments. GUI tools that provide interfaces to show collections of items will assume that the application uses the JavaSoftJKD 1.2 collection interfaces. Tools that directly support the ODMG standard are already in development.
About the ODMG
The ODMG is a non-profit consortium of database vendors and interested parties who collaborate to define data storage portability standards for object-oriented applications. Since its inception in 1991, the ODMG has continued to grow and today includes database vendors, tool vendors, consulting firms, and corporate end users. The ODMG membership consists of voting, reviewer and associate members. Voting membership requires that a company commits 20 percent of the time of a senior technical representative to ODMG activities and uses the ODMG standard. Reviewer membership requires a company to commit 10 percent of the time of a senior technical representative, but does not confer voting privileges. Associate membership allows companies that cannot commit to a high level of standards development participation to track to the certification development process.
Member companies include Advanced Language Technologies, Andersen Consulting, Ardent Software, Baan, CERN, Computer Associates, Ericsson, GemStone Systems, Hitachi, IBEX Computing SA, JavaSoftSun Microsystems, Lockheed Martin, Microsoft, NEC Corporation, Object Design, The Object People, Objectivity, POET Software, Sybase, Telenor R&D, Versant Object Technology, and Watershed Technologies.
For more information about the ODMG, visit its web site at www.odmg.org. The ODMG Java Binding specification is published in ODMG 2.0 (ISBN 1-55860-463-4), edited by R. G. G. Cattell and Douglas K. Barry, available from Morgan Kaufmann Publishers.
Douglas Barry has worked in database technology for more than 20 years, with an exclusive focus on the application of database technology for objects since 1987. He is the author of The Object Database Handbook (John Wiley & Sons, 1996), The Object Storage Fact Book (Barry & Associates, 1998), and The ODBMS Implementation Stories (Barry & Associates, 1996). He also serves as the executive director of the ODMG. You can email him at firstname.lastname@example.org. His Web site is www.odbmsfacts.com.
David Jordan is a Consulting Engineer at Ericsson in Research Triangle Park, North Carolina. Prior to Ericsson, he was at Bell Laboratories for 15 years. David’s career focus has been databases and object technology. He was appointed a Distinguished Member of Technical Staff at Bell Labs for his contributions in these areas. David is the author of C++ Object Databases, published by Addison-Wesley. Currently, he serves as the Java and C++ editor for the Object Data Management Group (ODMG).