Object-Relational Mapping

Similar documents
foreword to the first edition preface xxi acknowledgments xxiii about this book xxv about the cover illustration

Object-Relational Mapping Tools let s talk to each other!

object/relational persistence What is persistence? 5

Unit - IV CHAPTER - 13 INTRODUCTION TO OOP WITH C++ Part 1 Choose the best answer

Database Application Architectures

/ / JAVA TRAINING

Course Syllabus. Course Title. Who should attend? Course Description. ASP.NET ( Level 1 )

Table of Contents. I. Pre-Requisites A. Audience B. Pre-Requisites. II. Introduction A. The Problem B. Overview C. History

Pro JPA 2. Mastering the Java Persistence API. Apress* Mike Keith and Merrick Schnicariol

Fast Track to EJB 3.0 and the JPA Using JBoss

COMP 430 Intro. to Database Systems. SQL from application code

PHP Object-Relational Mapping Libraries in action

COURSE DETAILS: CORE AND ADVANCE JAVA Core Java

COMP9321 Web Application Engineering

Object-relational mapping EJB and Hibernate

purequery Deep Dive Part 2: Data Access Development Dan Galvin Galvin Consulting, Inc.

COMP9321 Web Application Engineering

Object-Relational Modeling

Hibernate OGM Architecture

Lecture 2 and 3: Fundamental Object-Oriented Concepts Kenneth M. Anderson

Java EE Application Assembly & Deployment Packaging Applications, Java EE modules. Model View Controller (MVC)2 Architecture & Packaging EJB Module

Elementary Concepts of Object Class

Java Persistence API (JPA) Entities

Prototype 1.0 Specification

Project # 1: Database Programming

"Charting the Course... Mastering EJB 3.0 Applications. Course Summary

Increasing Maintainability of Sale Charting Programs Using Fluent NHibernate ORM and MVP Pattern

10265: Developing Data Access Solutions with Microsoft Visual Studio 2010 Duration: 5 Days Method: Instructor-Led

Lightweight J2EE Framework

Object Persistence and Object-Relational Mapping. James Brucker

Hibernate Search Googling your persistence domain model. Emmanuel Bernard Doer JBoss, a division of Red Hat

C08: Inheritance and Polymorphism

Classes and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable?

CO Java SE 7: Develop Rich Client Applications

Parallel linked lists

10264A CS: Developing Web Applications with Microsoft Visual Studio 2010

1Z Java SE 5 and 6, Certified Associate Exam Summary Syllabus Questions

Web Application Development Using JEE, Enterprise JavaBeans and JPA

CO Java EE 6: Develop Database Applications with JPA

A Quick Database Comparison of Db4o and SQL Databases through Cayenne

SUN Sun Certified Enterprise Architect for J2EE 5. Download Full Version :

"Charting the Course... MOC A Developing Data Access Solutions with Microsoft Visual Studio Course Summary

CMPT 354 Database Systems I

Mappings and Queries. with. Hibernate

CS221 Lecture: The Relational Data Model

Hibernate Overview. By Khader Shaik

Developing Data Access Solutions with Microsoft Visual Studio 2010

System Analysis and Design. Introduction: Object Oriented Design

Hibernate Interview Questions

Java EE Architecture, Part Three. Java EE architecture, part three 1(24)

ABOUT ISM UNIV ABOUT HIBERNATE ORM

Web Application Development Using Spring, Hibernate and JPA

Web Application Development Using JEE, Enterprise JavaBeans and JPA

Development of E-Institute Management System Based on Integrated SSH Framework

.NET Database Technologies. Entity Framework: Queries and Transactions

Chapter 5 Object-Oriented Programming

Managing Data in an Object World. Mike Fechner, Director, Consultingwerk Ltd.

CSE 308. Database Issues. Goals. Separate the application code from the database

Hibernate in close action. INF5750/ Lecture 3 (Part III)

1Z Oracle. Java Enterprise Edition 5 Enterprise Architect Certified Master

OBJECT ORIENTED PROGRAMMING

Java Object/Relational Persistence with Hibernate. David Lucek 11 Jan 2005

SLO Presentation. Cerritos College. CIS Date: 09/13/2018

Java Enterprise Edition

Object Oriented Programming. Michał Bereta

Object Orientated Analysis and Design. Benjamin Kenwright

Database Visual ARCHITECT 6.3

Oracle Fusion Middleware 11g: Build Applications with ADF Accel

DIPLOMA IN PROGRAMMING WITH DOT NET TECHNOLOGIES

Inheritance and Polymorphism

LEARN TO DEVELOP A LIVE PROJECT AS PER IT STANDARDS. Module 1: What we are going to Learn. Prerequisites

Web Application Development Using Spring, Hibernate and JPA

Introduction to Web Application Development Using JEE, Frameworks, Web Services and AJAX

VB.NET. Exercise 1: Creating Your First Application in Visual Basic.NET

Database Visual ARCHITECT 5.2

Persistence on Score Management of Japanese-Language Proficiency Test Based on NHibernate Fengjuan Liu

Enterprise Features & Requirements Analysis For EJB3 JPA & POJO Persistence. CocoBase Pure POJO

Java Persistence API (JPA)

UML Getting Started - UML Modeling in Eclipse Written Date : March 03, 2016

Java EE Architecture, Part Three. Java EE architecture, part three 1(57)

Java Object Oriented Design. CSC207 Fall 2014

Lecture 4: Design Concepts For Responsibility- Driven Design Kenneth M. Anderson January 20, 2005

What are the characteristics of Object Oriented programming language?


Web Application Design. Husni Husni.trunojoyo.ac.id

XXII. Website Design. The Web

Sri Vidya College of Engineering & Technology

What data persistence means? We manipulate data (represented as object state) that need to be stored

Object Oriented Programming. C++ 6 th Sem, A Div Ms. Mouna M. Naravani

CS1004: Intro to CS in Java, Spring 2005

Refactoring 101. By: Adam Culp

Open Source Library Developer & IT Pro

Developing Microsoft.NET Applications for Windows (Visual Basic.NET)

Appendix A - Glossary(of OO software term s)

Co-Evolving Code-Related and Database-Related Changes in a Data-Intensive Software System

Encapsulation. Mason Vail Boise State University Computer Science

Designing the M in MVC

Development of web applications using Google Technology

The course introduces many of the techniques and technologies employed by modern desktop and enterprise applications, including:

Perform Database Actions Using Java 8 Stream Syntax Instead of SQL. Emil Forslund Java Developer Speedment, Inc.

Transcription:

Object-Relational Mapping

Object-Relational Mapping Software Architecture ORM Problems ORM Solutions Demo

Software Architecture Part 1 Architecture Separation of Concerns A design principle that comprises the process of separating a computer program into distinct features that overlap in functionality as little as possible Architecture style A set of of principals that shape an application Improves SoC and promotes reusable solutions Examples Service-Oriented Architecture Component-Based Architecture 3-Tier Architecture

Presentation Layer Logic Layer Data Access Layer Database

Data Access Layer Provides simplified access to data stored in persistent storage, such as a relational database. Might return an object to the business layer when the business layer makes a request for some data. This layer is in charge of communicating to the database. Should encapsulate the data storage type and data access method This is the layer provided by Object- Relational Mapping

Data Access Layer using Object- Relational Mapping Table: Course class Course { private: string cnum; int credits; string title; public: // getters // & setters }

Object-Relational Mapping Part 2 ORMapping Problems Two Paradigms Object-Oriented Programming Relational Database Model The don't always play nice together Problem of Granularity Problem of Inheritance Problem of Identity Problems of Association Problem of Data Navigation

Object-Relational Mapping Problem of Granularity Fine grain classes can be a part of coarse grain classes (class composition). Relations do not have this feature The granularity problem comes when the number of classes mapping to number of tables in the database do not match.

Problem of Granularity For example, let's say we have the User class which has an Address object. public class User{ private String Name; private Address address; } //Setters and getters public class Address{ private String city; private String country; } //Setters and getters

Problem of Granularity Suppose the table structure for User is Table USER: NAME, CITY, COUNTRY One way to capture this relation using the User and Address classes. There is one table but the data is sitting in two objects. The same problem can come the other way round also where you have two tables and one class containing all the data points. ORM has to take care of this mismatch.

Object-Relational Mapping Problem of Inheritance Classes can inherit from other classes, this can be difficult to represent in a database How should class inheritance be represented with relations? There is also a polymorphism problem. A reference of User type can refer to an object of Student or Teacher. The ORM has to somehow differentiate between data that is belonging to User or Student or Teacher.

Object-Relational Mapping Problem of Identity In the relational model, the primary key determines identity. Default equality of objects is usually reference Must implement an equals method Situation gets more complicated when one table is represented by more than one class and in multithreaded applications.

Object-Relational Mapping Problem of Association Object association is directional, one object contains another There is no notion of directionality with Relational associations (foreign keys) There are just tables and keys Many-to-many relationships can be represented as 3 tables, how should this be represented with classes

Object-Relational Mapping Problem of Data Navigation Accessing data in an object is different from accessing data in a table With objects we use getters e.g. order.getlineitem().getproduct(); With relations we use joins How do we map between these?

Object-Relational Mapping Recap Problem of Granularity Problem of Inheritance Problem of Identity Problems of Association Problem of Data Navigation

Object-Relational Mapping Part 3 ORMapping Solutions Solutions Write a Data Access Layer from scratch Use an ORM software Converts data stored relationally into objects There are many software tools that can do this automatically Relational Database => Classes Classes=> Relational Database

Java Java Persistence API (JPA) Hibernate, open source ORM framework, widely used PHP CakePHP Zend Framework C++ ODB QxORM.NET ADO.NET Entity Framework, included in.net Framework 3.5 SP1 and above NHibernate, open source Company Object-Relational Mapping Software

Object-Relational Mapping Pros Provide a way to persist objects using a relational database reduces the amount of code that needs to be written Allow the programmer to query data in a programming language and not with SQL Query with code completion!

Object-Relational Mapping Cons Can be slow Often lead to learning ORM specific features instead of just learning SQL Some complex queries cannot be done without SQL Can produce poorly designed databases

Object-Relational Mapping Software ADO.NET Entity Framework Part 4 Demo