Modern Database Techniques Part 1: Object Oriented Databases 3. Different Kinds of OODB Overview OO language + persistence Pure OODB DB with object and relational access Object-Relational Databases Object oriented interface to relational databases 2 OO language + persistence Use a class library with an abstract class or interface for persistent objects. In your application create persistent classes as subclasses of that abstract class. Search for objects by object navigation. Write code for search yourself. No additional software like a database browser provided. Often only one OO language supported. No access to data by other languages. 3 OO language + persistence Dependent on the special product more or less support for transactions or concurrent access provided. Advantage: Not much overhead Disadvantage: Not much functionality Examples: GemStone, ozone Persistance Interface Your code DB 4 Pure OODBMS Pure OODBMS are similar to "OO language + persistence" They enhance this model considerably: OODBMS implement a subset of the ODMG-model Variety of predefined template classes for sets, lists, arrays, … with appropriate functions Persistent class offers a query-function Transactions, concurrency, logging, recovery, constraints, and triggers are supported. Tools for DB-schema development Tools like DB-browser 5 Pure OODBMS (cont.) Advantage: Complete DB functionality Disadvantage: Often only one or two OO languages supported. Examples: ObjectStore, Versant Application 1 OODBMS DB Application 2 6 DB with object and relational access Like pure OODBMS and relational databases Two different interfaces to database: OO interface and SQL interface SQL is also used for DB queries on the object side. Advantages: Well known query language Support of standard interfaces e. g. ODBC and JDBC Disadvantage: Not ODMG compliant. 7 DB with object and relational access Examples: Caché (InterSystems) Titanium (Savitar Corp.) Application 3 Application 1 SQL access OODBMS Application 2 DB OO access 8 Object-Relational Databases Object oriented technology on top of relational technology and in the relational context. Define types instead of classes. Objects are stored in tables of objects rather than in tables of rows. Support of major object oriented features: complex types, inheritance, aggregation, methods Advantage: Extension of a well known technology Disadvantages: Mixture of both technologies may result in difficult to understand schemas Performance problems 9 Object-Tables instead of Tuple-Tables Object-Table Persons Meier, 1.5.60, ... Huber, 11.5.69, ... Miller, 1.12.60, ... Tuple-Table Persons Name Meier Huber Miller Meier DateOfBirth 1.5.60 11.5.69 1.12.60 7.5.80 ... Meier, 7.5.80, ... Person_type: Name, DateOfBirth, ... Separation of structure definition and table definition as set of objects instead of set of tuples 10 Object-Relational Databases Examples: Oracle 10g IBM DB2 PostgreSQL 11 Object Oriented Interface to Relational Databases Object oriented access to persistent objects Persistent objects stored as rows in relational database Mapping of objects to rows transparent to application 12 Object Oriented Interface to Relational Databases Advantage: Use familiar object oriented programming techniques for your applications and relational techniques for databases. Disadvantages: Mapping not fully transparent Performance problems Example: Hibernate Application p.Save() object rel. side side insert into persons … relational DBMS DB 13