SEG4110 - Advanced Software Design and Reengineering Topic O ORM: Object Relational Mapping.

Slides:



Advertisements
Similar presentations
Object Oriented Analysis And Design- IT0207 III Semester UNIT-IV.
Advertisements

Build a database I: Design tables for a new Access database
CHAPTER OBJECTIVE: NORMALIZATION THE SNOWFLAKE SCHEMA.
Chapter 10: Designing Databases
The Hierarchical Model
BUSINESS DRIVEN TECHNOLOGY Plug-In T4 Designing Database Applications.
Database Systems: Design, Implementation, and Management Tenth Edition
Database management concepts Database Management Systems (DBMS) An example of a database (relational) Database schema (e.g. relational) Data independence.
Access A Relational Database Management System. Prof. Leighton2 Database ► A database is a collection of data that’s related to a particular topic ► A.
Chapter 14 Getting to First Base: Introduction to Database Concepts.
Geographic Information Systems
Designing a Database Unleashing the Power of Relational Database Design.
Attribute databases. GIS Definition Diagram Output Query Results.
Data at the Core of the Enterprise. Objectives  Define of database systems  Introduce data modeling and SQL  Discuss emerging requirements of database.
APPENDIX C DESIGNING DATABASES
Page 1 ISMT E-120 Desktop Applications for Managers Introduction to Microsoft Access.
Chapter 9 Domain Models. Domain Model in UML Class Diagram Notation A “visual dictionary”
COMPUTING FOR BUSINESS AND ECONOMICS-III. Lecture no.6 COURSE INSTRUCTOR- Ms. Tehseen SEMESTER- Summer 2010.
ระบบฐานข้อมูลขั้นสูง (Advanced Database Systems) Lecturer AJ. Suwan Janin Phone:
UML Unified Modeling Language. What is UML? Unified Modeling Language (UML) is a standardized, general-purpose modeling language in the field of software.
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.
Databases Illuminated Chapter 8 The Enhanced Entity-Relationship Model and the Object-Relational Model.
Chapter 9 Designing Databases Modern Systems Analysis and Design Sixth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
CHAPTER 8: MANAGING DATA RESOURCES. File Organization Terms Field: group of characters that represent something Record: group of related fields File:
Copyright 2008 McGraw-Hill Ryerson 1 TECHNOLOGY PLUG-IN T5 DESIGNING DATABASE APPLICATIONS.
1 The Relational Database Model. 2 Learning Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T5: Designing Database Applications Business Driven Technology.
Object Oriented Analysis and Design 1 Chapter 7 Database Design  UML Specification for Data Modeling  The Relational Data Model and Object Model  Persistence.
Copyright © 2005 Ed Lance Fundamentals of Relational Database Design By Ed Lance.
What we’ve learnt Doc 5.69 Doc 5.70 Section 1-3. A simple database Related objects Tables hold the data Forms, reports, queries to access the data.
Chapter 12: Designing Databases
CS3773 Software Engineering Lecture 04 UML Class Diagram.
Architectural Patterns Support Lecture. Software Architecture l Architecture is OVERLOADED System architecture Application architecture l Architecture.
In this session, you will learn to: Map an ER diagram to a table Objectives.
BTS430 Systems Analysis and Design using UML Domain Model—Part 2: Associations and Attributes.
Database Fundamentals CSC105 Furman University Peggy Batchelor.
Database Design Some of these slides are derived from IBM/Rational slides from courses on UML and object-oriented design and analysis. Copyright to the.
Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Data Analysis 4 Chapter 2.4 V3.0 Napier University Dr Gordon Russell.
Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects.
BTS430 Systems Analysis and Design using UML Domain Model—Part 2: Associations and Attributes.
6.1 © 2007 by Prentice Hall Chapter 6 (Laudon & Laudon) Foundations of Business Intelligence: Databases and Information Management.
FEN Mapping from Class Diagram (Domain Model) to Relational Model Table Design.
NoSQL: Graph Databases. Databases Why NoSQL Databases?
Lecture 4: Logical Database Design and the Relational Model 1.
1 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Chapter 10 Designing Databases.
DOMAIN MODEL—PART 2: ATTRIBUTES BTS430 Systems Analysis and Design using UML.
DBS201: Data Modeling. Agenda Data Modeling Types of Models Entity Relationship Model.
Relational vs. Object Oriented Database Management System Syazwani Nur Dayana Nur Fatin Syafiqa M3cs2305B.
2b. Create an Access Database Lingma Acheson Department of Computer and Information Science IUPUI CSCI N207 Data Analysis with Spreadsheets 1.
Microsoft Access 2013 ®® Case Study Creating a Database.
Chapter 2: Entity-Relationship Model
Chapter 9 Domain Models.
DATA REQIREMENT ANALYSIS
Databases Chapter 16.
Entity-Relationship Model
CSCI-100 Introduction to Computing
© 2011 Pearson Education, Inc. Publishing as Prentice Hall
Case Study Creating a Database
Database management concepts
LECTURE 34: Database Introduction
Understand and Use Object Oriented Methods
Systems Analysis – ITEC 3155 Modeling System Requirements – Part 2
Database management concepts
Getting to First Base: Introduction to Database Concepts
Getting to First Base: Introduction to Database Concepts
Getting to First Base: Introduction to Database Concepts
LECTURE 33: Database Introduction
Course Instructor: Supriya Gupta Asstt. Prof
Presentation transcript:

SEG Advanced Software Design and Reengineering Topic O ORM: Object Relational Mapping

SEG Topic O - Object Relational Mapping2 Rules for Mapping an Object Model to a Relational Database 1 General Rules A. Create one table for each ordinary class 1. Make each instance a row in the table 2. Make each simple attribute or qualifier into a column 3. If a complex attribute is naturally composed of separate fields, make these into individual columns 4. If a complex attribute consumes much space but is infrequently accessed, store it in a separate table. 5. Make 1-1 or many-1 association into either i. a column (using a foreign key) ii. a separate table with foreign keys indicating each end of the relation

SEG Topic O - Object Relational Mapping3 Object-Relational Mapping Rules 2 General rules cont … A. cont … 6. Decide on the key: -The key must uniquely distinguish each row in the table i. If unique, one or more of the attributes may constitute the key ii. Otherwise, generate a column that will contain a special object-id as the key

SEG Topic O - Object Relational Mapping4 Object-Relational Mapping Rules 3 General rules cont … B. Create one table for each association that has many- many multiplicity (and for each association class) 1. Make the keys of the tables being related to be foreign keys in this new table 2. If we are creating an association class with additional associations connecting to it, then create a special object-id as the key 3. Follow rules A1 to A5

SEG Topic O - Object Relational Mapping5 Object-Relational Mapping Rules 4 General rules cont … C. Deal with inheritance in either of the following two ways: 1. Keep inherited material in a common table. -For each object, create a row in both a table for the superclass and a table for the appropriate subclass -Relate the two tables using a foreign key in the subclass table -This is the recommended approach, but has the following drawbacks: »It requires a join to access any object »It requires inventing an identifier 2. Inherited columns can be duplicated in all subclass tables -There may be no need for a table representing the superclass -The duplication reduces maintainability

SEG Topic O - Object Relational Mapping6 Example class diagram for an inventory system

SEG Topic O - Object Relational Mapping7 Inventory System Tables 1 Resulting tables:Reason ProductA product-code (key)A2, A6i descriptionA2 list-price-per-unitA2 number-in-inventoryA2 number-to-keep-in-invA2 Product-PictureA4 product-code (foreign-key) picture-bitmap

SEG Topic O - Object Relational Mapping8 Inventory System Tables 2 SupplierA supplier-id (key)A2, A6i nameA2 streetA3 cityA3 postal-codeA3 Product-SourceB product-source-id (key)B2 product-code (foreign-key)B1 supplier-id (foreign-key)B1 suppliers-code-for-productA2 advertised-cost-per-unitA2

SEG Topic O - Object Relational Mapping9 Inventory System Tables 3 Order-To-SupplierA po-number (key)A2, A6i supplier-id (foreign-key)A5i date-orderedA2 Supplier-Order-Line-ItemA line-item-idA6ii po-number (foreign-key)A5i product-source-id (foreign-key)A5i number-orderedA2 date-expectedA2

SEG Topic O - Object Relational Mapping10 Example Class Diagram for Document System - with Inheritance

SEG Topic O - Object Relational Mapping11 Document System Tables 1 Resulting tables:Reason Document-ComponentA component-key (key)A6ii start-posA2 end-posA2 Compound-ComponentA component-key (foreign-key)C1 typeA2

SEG Topic O - Object Relational Mapping12 Document System Tables 2 Primitive-ComponentA component-key (foreign-key)C1 textA2 emphasisA2 Top-DocumentA component-key (foreign-key)C2 typeC2 nameA2 Part-RelationA5ii part-key (foreign-key) whole-key (foreign-key)

SEG Topic O - Object Relational Mapping13 Data modeling vs. OO modeling Data Modelling followed by RDBMS use Object-Oriented Modelling followed by OODMBS use Associations computed using joins - Keys have to be developed Associations are explicit using pointers Only primitive data stored in columns (characters, numbers) Structured data of arbitrary complexity can be stored. Code independently developed and in different places Code found in classes An ‘object’ can be distributed among tables - A problem for complex objects An object in one place, so is fast to access Associations are by default bi- directional - I am the son of my father and he is the father of me Associations can be unidirectional - I know the Queen, but she doesn’t know me