Download Mobule 14 - Mapping Relational DB to OO

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

DBase wikipedia , lookup

IMDb wikipedia , lookup

Serializability wikipedia , lookup

Relational algebra wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Oracle Database wikipedia , lookup

Microsoft Access wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Navitaire Inc v Easyjet Airline Co. and BulletProof Technologies, Inc. wikipedia , lookup

Ingres (database) wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Functional Database Model wikipedia , lookup

SQL wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

PL/SQL wikipedia , lookup

Concurrency control wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Database wikipedia , lookup

ContactPoint wikipedia , lookup

Clusterpoint wikipedia , lookup

Versant Object Database wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
Module 14 – Mapping Relational Databases to OO Databases
Content:
In this chapter we cover an overview of mapping relational databases to object-oriented
databases in order to provide object persistence.
In this chapter we examine how object-oriented can be incorporated with relational models.
Object-relational mapping
Definition of structural relationships between object-oriented and relational representations of
data, typically to enable the use of a relational database to provide persistence for objects.
Object-relational impedance mismatch
The conceptual differences between the object-oriented approach to application design and the
relational model for database design and implementation.
Elements of the Object-Relational Impedance Mismatch
•Nature and granularity of data types
•Structural relationships:
•Inheritance structures
•Representation of associations
•Defining the identity of objects/entity instances
•Methods of accessing persistent data
•Focus on data (relational databases) versus integrated data and behavior (the object-oriented
approach)
•Architectural styles
•Support for managing transactions
The most typical approaches for providing persistence for objects include call-level application
programming interfaces, SQL query mapping frameworks, and object-relational mapping
frameworks.
Call-level application programming interface
A mechanism that provides an application program with access to an external service, such as a
database management system
Transparent persistence
A persistence solution that hides the underlying storage technology.
Declarative mapping schema
A structure that defines the relationships between domain classes in the object-oriented model
and relations in the relational model
Advantages and Disadvantages of the SQL Query Mapping Frameworks
Advantages
•Direct access to all DBMS capabilities provided through SQL
•Mapping to legacy database schemas easier
•Amount of code required significantly less than with call-level APIs
•Database access code easier to manage than with call-level APIs
Disadvantages
•More overhead than with call-level APIs
•Developers need a detailed understanding of DBMS capabilities and the database schema
•SQL code not generated automatically
•The approach does not provide transparent persistence
Advantages and Disadvantages of the Call-Level API Approach
Advantages
•Low overhead
•Highest level of control over the details of the database connection
•Proliferation of code related to database connectivity
Disadvantages
•Need to write a lot of detailed code
•Little reuse of code
•Developers need a detailed understanding of DBMS capabilities and the database schema
•SQL code not generated automatically
•The approach does not provide transparent persistence
Advantages and Disadvantages of the Object-Relational Mapping Frameworks
Advantages
•They provide the highest level of persistence transparency
•Developers do not need to have a detailed understanding of the DBMS or the database schema
•The implementation of persistence is fully separated from the rest of the code
•They enable true object-oriented design
Disadvantages
•There is more overhead than with call-level APIs and with query mapping frameworks
•Complex cases often need detailed attention
•Legacy databases lead to difficulties
Typical Responsibilities of the Object-Relational Mapping Frameworks
•Provide a layer of abstraction between object-oriented applications and a database schema
implemented with a DBMS leading to transparent persistence
•Generate SQL code for database access
•Centralize code needed to access the database
•Provide support for transaction integrity and management
•Provide services for concurrency control
•Provide a query language
HQL, the query language in Hibernate, resembles SQL in many ways and is sometimes used for
the relational-object-oriented mapping, database creation and manipulation.
Links:
https://www.youtube.com/watch?v=80zy2LsYQBE
https://www.youtube.com/watch?v=80zy2LsYQBE
https://en.wikipedia.org/wiki/Object-relational_mapping