Object Relational Mapping. What does ORM do? Maps Object Model to Relational Model. Resolve impedance mismatch. Resolve mapping of scalar and non-scalar.

Slides:



Advertisements
Similar presentations
An Object/Relational Mapping tool Free and open source Simplifies storage of object data in a relational database Removes the need to write and maintain.
Advertisements

CHAPTER OBJECTIVE: NORMALIZATION THE SNOWFLAKE SCHEMA.
Introduction to Databases
Data - Information - Knowledge
File Systems and Databases
Data Management Design
Geographic Information Systems
Chapter 11 Data Management Layer Design
U of R eXtensible Catalog Team MetaCat. Problem Domain.
Chapter 4: Database Management. Databases Before the Use of Computers Data kept in books, ledgers, card files, folders, and file cabinets Long response.
CIS607, Fall 2005 Semantic Information Integration Article Name: Clio Grows Up: From Research Prototype to Industrial Tool Name: DH(Dong Hwi) kwak Date:
Session-02.
Chapter 1 Introduction to Databases
Session-01. Hibernate Framework ? Why we use Hibernate ?
Introduction to Databases Transparencies 1. ©Pearson Education 2009 Objectives Common uses of database systems. Meaning of the term database. Meaning.
Class 3 Data and Business MIS 2000 Updated: January 2014.
Chapter 1 Database Systems. Good decisions require good information derived from raw facts Data is managed most efficiently when stored in a database.
Database Design Concepts
DBMS By Narinder Singh Computer Sc. Deptt. Topics What is DBMS What is DBMS File System Approach: its limitations File System Approach: its limitations.
CS370 Spring 2007 CS 370 Database Systems Lecture 2 Overview of Database Systems.
Chapter 1 Introduction to Databases Pearson Education ©
Data Access Patterns Some of the problems with data access from OO programs: 1.Data source and OO program use different data modelling concepts 2.Decoupling.
NHibernate in Action Web Seminar at UMLChina By Pierre Henri Kuaté 2008/08/27
Database Technical Session By: Prof. Adarsh Patel.
Seminar on. Overview Hibernate. What is it? Hibernate. How does it work? Hibernate Tools.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 4th Edition Copyright © 2009 John Wiley & Sons, Inc. All rights.
Object Oriented Analysis and Design 1 Chapter 7 Database Design  UML Specification for Data Modeling  The Relational Data Model and Object Model  Persistence.
1 Part 2: EJB Persistency Jianguo Lu. 2 Object Persistency A persistent object is one that can automatically store and retrieve itself in permanent storage.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
5 - 1 Copyright © 2006, The McGraw-Hill Companies, Inc. All rights reserved.
Domain and Persistence Patterns. Fundamental Pattern Types Design Patterns Business Logic Patterns.
8 1 Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Entity Framework Code First – Beyond the Basics Sergey Barskiy, Magenic Microsoft MVP – Data Platform Principal Consultant.
Databases.
Component 4/Unit 6b Topic II Relational Databases Keys and relationships Data modeling Database acquisition Database Management System (DBMS) Database.
CIS/SUSL1 Fundamentals of DBMS S.V. Priyan Head/Department of Computing & Information Systems.
GIS Data Models GEOG 370 Christine Erlien, Instructor.
Database Management Systems (DBMS)
Information Systems Today: Managing in the Digital World TB3-1 3 Technology Briefing Database Management “Modern organizations are said to be drowning.
Hibernate Basics. Basics What is persistence? Persistence in Object Oriented Applications? Paradigm Mismatch.  The Problem of Granularity.  The Problem.
Persistence – Iteration 4 Vancouver Bootcamp Aaron Zeckoski
Entity Framework Code First – Beyond the Basics Sergey Barskiy, Magenic Microsoft MVP – Data Platform Magenic, Principal Consultant Level: Introductory.
V 1.0 DBMAN 9 Inheritance Modeling + Relational Databases 1.
Mapping Objects ↔Relational DB. The Problem with Databases Databases store data in rows in tables, which are not like objects. We can simulate object.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th Edition Copyright © 2015 John Wiley & Sons, Inc. All rights.
Introduction to ORM Hibernate Hibernate vs JDBC. May 12, 2011 INTRODUCTION TO ORM ORM is a programming technique for converting data between relational.
ORM Basics Repository Pattern, Models, Entity Manager Ivan Yonkov Technical Trainer Software University
Retele de senzori Curs 2 - 1st edition UNIVERSITATEA „ TRANSILVANIA ” DIN BRAŞOV FACULTATEA DE INGINERIE ELECTRICĂ ŞI ŞTIINŢA CALCULATOARELOR.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Data Models. 2 The Importance of Data Models Data models –Relatively simple representations, usually graphical, of complex real-world data structures.
Database Planning Database Design Normalization.
Hibernate Java Persistence API. What is Persistence Persistence: The continued or prolonged existence of something. Most Applications Achieve Persistence.
1 Management Information Systems M Agung Ali Fikri, SE. MM.
Relational vs. Object Oriented Database Management System Syazwani Nur Dayana Nur Fatin Syafiqa M3cs2305B.
Introduction to Databases
New Technology: Why, What ,How
Introduction to Entity Framework
Relational Model.
The Context of Database Management
Object-Oriented Database Management System (ODBMS)
Introduction to Databases
Data Base System Lecture 2: Introduction to Database
Hibernate Bayu Priyambadha, S.Kom.
Data Model.
Introduction to Databases
Introduction to Databases
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management
Database management systems
Presentation transcript:

Object Relational Mapping

What does ORM do? Maps Object Model to Relational Model. Resolve impedance mismatch. Resolve mapping of scalar and non-scalar. Database – Independent applications. Table1 Table2 Table3 Table1 Table2 Table3 Object Model ORM Data Model

How does ORM work? Meta Data is information about data. Keeps record of which attribute/s is/are mapped to which column. Brain of ORM. Table1 Table2 Table3 Table1 Table2 Table3 Mata Data

Property to Column dataOrdered has the same type, Date. Three tax attributes matching one TAX column and the type is different. shipTo passes the person id to >. orderId >. Follows Agile Method Naming Standard.

Property to Column (cont) PropertyColumn Order.orderIDOrder.OrderID Order.dateOrderedOrder.DateOrdered Order.getTotalTax()Order.Tax Order.shipto.personIDOrder.ShipToContactID OrderItem.orderedOrderItem.OrderID OrderItem.item.numberOrderItem.ItemNo OrderItem.numuberOrderedOrderItem.NumuberOrdered

Inheritance Mapping RDMS does not support inheritance! ORM supports three inheritance mapping; Map hierarchy to a single table. Map concrete class to a table. Map every class to a table.

Map hierarchy to a single table All attributes are transformed into columns.

Advantages of Mapping hierarchy to a single table Very simple method to map objects to a relational database. New classes can be added easily by inserting a new column into the table. High performance in retrieving the data, because there are no joins in the query.

Disadvantages of Mapping hierarchy to a single table Any changes applied to one class forces the table to be changed along with the other classes in the same hierarchy. Each department has an unused column wasting a lot of memory space. Database normalization may be affected.

Map concrete class to a table Each Concrete class is mapped to its own table. Both concrete classes inherit the DepID and Name.

Advantages of mapping concrete class to a table Data access for a single department is very good. Ad-hoc reporting for a single department is facilitated by the fact that each table relates to only one department.

Disadvantages of mapping concrete class to a table Changes in the Department class affects both sales and purchase departments. The first disadvantage leads to data redundancy issues.

Map every class to a table Each class in the Object Model is mapped to a corresponding Entity in the Relational Model. The Sales and Purchase entities hold a reference to the department entity.

Advantages of mapping every class to a table Super classes are very easy to modify or create. The concrete classes are also very easy to modify. The all structure is very easy to understand thanks to the one-to-one relationship between classes and tables. Polymorphism becomes natural to achieve.

Disadvantages of mapping every class to a table Queries are usually slower compare to the previous solution because sometimes join query may be necessary. Ad-hoc reporting can be tough task to achieve, views resolve this problem.

Hibernate vs iBATIS They are both open source. They both use XML to configure Meta Data. They both require POJO classes format. Table1 Table2 Table3 Table1 Table2 Table3 Hibernate / iBATIS

Hibernate vs iBATIS (cont) Advantages Hibernate SQL statements are automatically generated. Useful where the object model dictates the rules of the game. Disadvantages Hibernate Complex systems are difficult to implements. Stored procedure and reporting are difficult to create.

Hibernate vs iBATIS (cont) Advantages of iBATIS Useful when the data model already exists or it dictates the persistence strategy. Stored procedure and reporting can be achieved very easily. Disadvantages of iBATIS More configuration involved due to the fact that queries are not automatically generated. It doesn’t have the vast power of Hibernate like caching.

Advantages of ORM Isolation of the database from the rest of the application, hence the all system is database - independent. Maintenance becomes very easy. Changes to both models will not affect each other. Productivity is increased due to the fact the lines of code are reduced. Domain objects can be easily mapped to the relational models.

Advantages of ORM (cont) ORM is very well established in the computing industry, facilitating further improvements. Most of the ORM engines are free in the form of open source software. Hybrid system, Hibernate + iBATIS.

Disadvantages of ORM (cont) Batch processing is not efficient using ORM. Reporting can not always be performed. It may be necessary to learn a new query language. Some ORM engines may not perform stored procedure.

The End Any Questions ?