15
OODB, Object- Oriented Mappings By: Blake Peters

By: Blake Peters. OODB- Object Oriented Database An OODB is a database management system in which information is represented in the form of objects

Embed Size (px)

Citation preview

Page 1: By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects

OODB, Object-Oriented Mappings

By: Blake Peters

Page 2: By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects

OODB- Object Oriented Database An OODB is a database management

system in which information is represented in the form of objects as used in object oriented programming.

OODBs are different from relational databases which are table oriented.

OODB

Page 3: By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects

OODB

Page 4: By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects

OODBs combine database capabilities with object-oriented programming language capabilities.

Allow object-oriented programmers to develop the product, store them as objects, and replicate or modify existing objects to make new objects.

OODB

Page 5: By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects

Like relational databases use SQL to query tables, OODBs use OQL (Object Query Language) to query objects

Objects can be retrieved directly without a search, by following pointers.

Allows faster access to data because joins are often not needed.

OODB

Page 6: By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects

Object Query Language syntax: SELECT * FROM [ INSTANCEOF ] <class

name> [ WHERE <filter-expression> ]

OQL

Page 7: By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects

Object-relational mapping (ORM) is a programming technique for converting data between incompatible type systems in object-oriented programming languages.

This creates a “virtual database” that can be used from within the programming language

Object-Relational Mapping

Page 8: By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects
Page 9: By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects

Compared to traditional techniques of exchange between an object-oriented language and a relational database, ORM often reduces the amount of code that needs to be written

ORM

Page 10: By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects

Using ORM in OODBs eliminates the need for converting data to and from its SQL form, as the data is stored in its original object representation and relationships are directly represented, rather than requiring join tables/operations.

ORM

Page 11: By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects

Consider an address book entry that represents a single person along with zero or more phone numbers and zero or more addresses

Using and OODB with ORM a “Person object” could be implemented with attributes/fields to hold each data item that the entry comprises: person’s name, list of phone numbers, and list of addresses.

Example

Page 12: By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects

The list of phone numbers whould itself contain “PhoneNumber objects” and so on

The address book entry is treated as a single object by the programming language (it can be referenced by a single variable containing a pointer to the object)

Methods could be written to return the desired phone number, address, etc

Example con’t

Page 13: By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects

Without the use of these object mappings, retrieving data is more difficult using SQL

SQL DBMS can only store and manipulate scalar values such as integers and strings organized within tables.

The programmer must either convert the object values into groups of simpler values for storage in the database, or only use simple scalar values within the program.

Example con’t

Page 14: By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects

This causes more coding for retrieval of values, and slower data access times

Example con’t

Page 15: By: Blake Peters.  OODB- Object Oriented Database  An OODB is a database management system in which information is represented in the form of objects

Questions?