ERCIM News No.35 - October 1998
GEN.LIB - An Approach to Object Persistence
by Jaroslav Pokorny
GEN.LIB is a library managing a persistency of application domain objects using relational database servers. It is also able to present rows of external (by other application maintained) tables as C++ objects. Thus, GEN.LIB is, in general, a part of the client application, which provides an interface between two different paradigms: a bridge between object oriented paradigm on side of the client, and a relational database server on the other side.
GEN.LIB has been developed as a part of the European ADDORE project (Application specific Depository of Object ORiented Environment) organized under the COPERNICUS programme. The ADDORE Consortium involved the Charles University, Czech Republic and the companies DCIT, Czech Republic, IQSOFT, Hungary, and Objectif Technologie, France. The project started in January 1995 and has been completed by the end of 1997.
GEN.LIB represents a stand-alone library usable without the rest of the ADDORE project. Its primary purpose was to implant the Rumbaughs OMT methodology of OO analysis and design into the environment of building business applications. The GEN.LIB part of the projects provides a support for persistence of C++ application objects and some possibilities to use relational tuples as objects in C++ programs. Moreover, some higher non-procedural querying capabilities are available in GEN.LIB. Concerning research motivations, we followed three well-known approaches to object persistence:
- Object/Relational Data Managers - they map objects directly to relational tables and manage objects.
- Relational Wrapper Libraries - they map objects to database objects, which are linked to relational database. The relational wrapper detects a change in the contents of an object and automatically generates the SQL to make the changes in the linked relational database. Similarly, it detects changes to relational database and moves that information back into the local objects.
- Object/Relational Databases - they store information using objects or relations, and they let developers access the data using either method.
The GEN.LIB addresses many of above trends. The library gives at least a possibility:
- to handle persistent and transient objects via C++ programs
- to conceive rows of relations as C++ objects
- to use high-level query facilities in C++ programs
- to use many of database-oriented features on the level of C++ programming.
In order to respect the ADOORE project objectives we should accept a set of common general requirements that increase the quality of the library. These requirements focus on the database aspects of GEN.LIB and are listed below:
- GEN.LIB provides general relational database management facilities: multiple sessions opened simultaneous on different and independent RDBMSs, multiple connections simultaneously opened on the database server, full support of the transaction handling, full support of all RDBMS features, resource allocation/de-allocation
- GEN.LIB is a library of components that provides transparent storage/retrieval services of the objects written in the target programming language (C++) in the relational database(s); this feature includes: automatic and transparent SQL generation and execution, enhanced memory management, transparent manipulation of the objects independent on the fact if the copy of the instance is in memory or not.
- GEN.LIB allows the execution of SQL treatment on the server side (for large set of data manipulation)
- GEN.LIB provides both object and set of objects access and manipulation facilities: mapping strategies for the storage of the native C++ objects in the relational database, mapping strategies for the representing data stored in the relational database using C++ objects, several kinds of obtaining sets of objects using various selection criteria, support for standard binary relations (one to one, one to many, many to many), retrieving objects related to given instance, etc., various locking strategies
- GEN.LIB handles the objects instances in the memory of the client application: uniqueness of each object of the domain layer, format transformation between objects attributes and tables column
- GEN.LIB supports DB errors handling: error capture, exception raising, strong default error handling (reconnection procedure, non-fatal error distinction, ...)
- GEN.LIB provides journalising facilities: DB statement journalising, DB error journalising, GEN.LIB internal error journalising, debugging information tracing (DB command/statement, main classes methods calls).
The prototype has been implemented on SUN stations connected with ORACLE server (Version 7). The library is fully functional. This fact is confirmed by using the library in WISE system (a workflow simulator and editor) implemented in DCIT. We must emphasise that the above set of functionality constitutes a compromise between all the needs of the future applications that will be developed using GEN.LIB. As a consequence, an important requirement of GEN.LIB was its flexibility: the analysis of the library as well as its design took into account the possible and reasonable extensions foreseen by its future users.
More information available on website: http://kocour.ms.mff.cuni.cz/adoore.html
Please contact:
Jaroslav Pokorny - CRCIM / Charles University
Tel: +420 2 21 91 42 65
E-mail: pokorny@ksi.ms.mff.cuni.cz