140 likes | 374 Views
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. OO language + persistence.
E N D
Modern Database TechniquesPart 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
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.
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 PersistanceInterface Your code DB
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
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
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.
DB with object and relational access • Examples: • Caché (InterSystems) • Titanium (Savitar Corp.) Application 3 Application 1 OODBMS SQL access DB Application 2 OO access
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
Object-Tables instead of Tuple-Tables Tuple-Table Persons Object-Table Persons Meier, 1.5.60, ... Huber, 11.5.69, ... Miller, 1.12.60, ... Meier, 7.5.80, ... Separation of structure definition and table definition as set of objects instead of set of tuples Person_type: Name, DateOfBirth, ...
Object-Relational Databases • Examples: • Oracle 10g • IBM DB2 • PostgreSQL
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
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 object side rel. side insert into persons … Application relationalDBMS DB p.Save()