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.

Slides:



Advertisements
Similar presentations
Chapter 10: Designing Databases
Advertisements

What is a Database By: Cristian Dubon.
Data Modeling and Database Design Chapter 1: Database Systems: Architecture and Components.
Database Systems: Design, Implementation, and Management Tenth Edition
.NET Database Technologies: Open-Source Frameworks.
Access Trisha Cummings. Access 1.Microsoft Access is a relational database management system from Microsoft, 2.Skilled software developers and data architects.
Chapter 2 Data Models Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Hibernate 1. Introduction ORM goal: Take advantage of the things SQL databases do well, without leaving the Java language of objects and classes. ORM.
Object Oriented System Development with VB .NET
Database Management: Getting Data Together Chapter 14.
Geographic Information Systems
11 3 / 12 CHAPTER Databases MIS105 Lec14 Irfan Ahmed Ilyas.
Chapter 4: Database Management. Databases Before the Use of Computers Data kept in books, ledgers, card files, folders, and file cabinets Long response.
Attribute databases. GIS Definition Diagram Output Query Results.
Object-Oriented Methods: Database Technology An introduction.
Evolution in Database Models
Session-02.
Chapter 1 Introduction to Databases
Data Persistence and Object-Relational Mapping Slides by James Brucker, used with his permission 1.
Enterprise Object Framework. What is EOF? Enterprise Objects Framework is a set of tools and resources that help you create applications that work with.
2 1 Chapter 2 Data Model Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Database System Concepts and Architecture Lecture # 3 22 June 2012 National University of Computer and Emerging Sciences.
Web-Enabled Decision Support Systems
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.
1 CS 430 Database Theory Winter 2005 Lecture 1: Introduction.
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
NHibernate in Action Web Seminar at UMLChina By Pierre Henri Kuaté 2008/08/27
2 1 Chapter 2 Data Models Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Database Technical Session By: Prof. Adarsh Patel.
CST203-2 Database Management Systems Lecture 2. One Tier Architecture Eg: In this scenario, a workgroup database is stored in a shared location on a single.
Database Design - Lecture 2
Data File Access API : Under the Hood Simon Horwith CTO Etrilogy Ltd.
CS 474 Database Design and Application Terminology Jan 11, 2000.
ORACLE
Object Oriented Analysis and Design 1 Chapter 7 Database Design  UML Specification for Data Modeling  The Relational Data Model and Object Model  Persistence.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
Instructor: Dema Alorini Database Fundamentals IS 422 Section: 7|1.
Hibernate Persistence. What is Persistence Persist data to database or other storage.  In OO world, persistence means persist object to external storage.
1 CS 430 Database Theory Winter 2005 Lecture 2: General Concepts.
Creating and Maintaining Geographic Databases. Outline Definitions Characteristics of DBMS Types of database Relational model SQL Spatial databases.
JPA / HIBERNATE CSCI 6370 Nilayan Bhattacharya Sanket Sable.
Database Management Systems (DBMS)
NSF DUE ; Wen M. Andrews J. Sargeant Reynolds Community College Richmond, Virginia.
Object storage and object interoperability
Introduction to Core Database Concepts Getting started with Databases and Structure Query Language (SQL)
CS422 Principles of Database Systems Object-Relational Mapping (ORM) Chengyu Sun California State University, Los Angeles.
CS520 Web Programming Object-Relational Mapping with Hibernate and JPA (I) Chengyu Sun California State University, Los Angeles.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
uses of DB systems DB environment DB structure Codd’s rules current common RDBMs implementations.
Data Models. 2 The Importance of Data Models Data models –Relatively simple representations, usually graphical, of complex real-world data structures.
Hibernate Java Persistence API. What is Persistence Persistence: The continued or prolonged existence of something. Most Applications Achieve Persistence.
IT 5433 LM1. Learning Objectives Understand key terms in database Explain file processing systems List parts of a database environment Explain types of.
SQL Basics Review Reviewing what we’ve learned so far…….
Chengyu Sun California State University, Los Angeles
IS444: Modern tools for applications development
IS444: Modern tools for applications development
ICT Database Lesson 1 What is a Database?.
Geographic Information Systems
ADO.NET Entity Framework Marcus Tillett
ADO.NET Entity Framework
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Database System Concepts and Architecture.
Chapter 6 System and Application Software
Hibernate Bayu Priyambadha, S.Kom.
PHP and MySQL.
Data Model.
Object-Oriented Databases
Chapter 6 System and Application Software
Chapter 6 System and Application Software
Chengyu Sun California State University, Los Angeles
Chapter 6 System and Application Software
Presentation transcript:

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 SQL queries

A little history…

Origins of Databases and Objects DBMS technology invented late 1960s OO technology invented late 1960s Independent evolution for over 20 years Different audiences –DBMS: corporate information systems –OO: academic and scientific

The Rise of Client/Server Corporate IT in early 90s High cost of mainframe hardware Low cost of the IBM PC-based platform Desire to move away from COBOL The hot languages were OO –Smalltalk –C++

Object Meets Relational Corporate IT already deeply invested in RDBMS Well just connect up our new client server applications to these databases! Efforts to marry the two technologies Discovery of the O/R Impedance Mismatch

The object/relational conflict

DBMS Representation Based on the concept of a Relation –A set of data values that go together –Represented as a Row in a Table No two rows should be duplicates –Useless to state the same fact twice Very useful for flexible set manipulation –SQL queries

Object-Oriented Representation An object is a model of something in the real world Public interfaces –How an object interacts with the rest of the world Private members –How an object behaves internally

Object-Oriented Representation Merges data and behavior –Allows an object to initiate interactions and respond flexibly to them –Important for modeling the real world Effective OO models allow for very high reuse –Parcel program logic and data into self- defined and self-consistent bundles

Object-Oriented Representation Each object (instance) is unique –even if all data members are equal Object types inherit from other types –allows for the creation of rich, powerful models –allows opportunities for reuse

O/R Impedance Mismatch Impedance matching –from electronics theory –matching a power source with a power load Mismatch between object and relational technologies –Different theoretical foundations Relations are facts about data relatedness Objects are models of reality

O/R Impedance Mismatch Mismatched uniqueness rules –Rows containing identical data are the same Considered undesirable –Objects containing identical data are different Common and useful equal, but not == Mismatched data model topologies –Relational tables are flat –Object types are hierarchical

O/R Mapping Tools Invented in early 1990s One of the first came from Cleveland –Raleigh Systems ObjectPM Shield the OO application from the database paradigm Mappings to tables and columns are localized in configuration files

[Enter: Hibernate] Initially developed for Java –created in late 2001 by Gavin King –absorbed by the JBoss Group / Red Hat Ported to.NET 1.1 and 2.0 –Resulting product called NHibernate All popular databases supported XML-based configuration files

What NHibernate Does Takes as input –a C# class with properties that need to be stored in a database and retrieved later –an XML file containing mapping information Outputs automatically generated SQL –when you tell NHibernate to save an object –when you ask NHibernate to search/load objects –can also create all database tables if desired

How to Use NHibernate Step 1: create an object oriented business model –Start simple: one or two small classes –Note which properties will save in DBMS Implement the model using C# –Best kept in a separate C# project

Step 2: The Mapping File One per business model class Named classname.hbm.xml Tells NHibernate where data is to reside –Name of table to store data for this class –Name of a column for each property in class Also describes relationships between classes –One-to-many, many-to-one, many-to-many Generated SQL is based on this information

Step 3: Configuration File XML-based file for global configuration Usually named hibernate.cfg.xml Application-wide settings Database connection string Database dialect –Specifies database product and version –Allows NHibernate to use non-standard features where appropriate Logging options

Step 4: User Interface Tasks Create business model objects Create an NHibernate session object Insert/Update to DBMS –Session.save(object) Retrieve business model data from the DBMS as business model objects –Session.load(type, id) –Session.find(query)

Step 5: Unit Test and Debug Unit tests can be created for each persistent class if desired –VSTS unit testing support –NUnit Run, test and debug in the usual fashion Sit back and relax…. Youre done!

Questions