SlideShare a Scribd company logo
ORM METHODOLOGY
AHMED GOMAA
LEAD SOFTWARE ENGINEER
GOMAA86@GMAIL.COM
OUTLINES
1. What is ORM ?!
2. Why ORM ?!
3. What is CORBA ?
4. Problem: Object-relational impedance mismatch
5. ORM Components and Architecture
6. Disadvantages of ORM
7. Comparison
8. Choosing an ORM tool
9. Demonstration of ORM using Micro ORM
10. What Next ?!
11. Q & A
12. References
WHAT IS ORM ?!
in computer science is a programming technique for converting data between incompatible type
systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that
can be used from within the programming language.
WHY ORM ?!
• Speeds-up Development - eliminates the need for repetitive SQL code.
• Reduces Development Time.
• Reduces Development Costs.
• Overcomes vendor specific SQL differences - the ORM knows how to write vendor specific SQL so you
don't have to.
• Rich query capability. ORM tools provide an object oriented query language.
WHAT IS CORBA ?!
• Common Object Request Broker Architecture (CORBA)
• A standard defined by the Object Management Group (OMG)
designed to facilitate the communication of systems that are
deployed on diverse platforms.
• Enables collaboration between systems on different operating
systems, programming languages, and computing hardware.
• CORBA has many of the same design goals as object-oriented
programming: encapsulation and reuse.
• CORBA uses an object-oriented model although the systems that
utilize CORBA do not have to be object-oriented.
OBJECT-RELATIONAL IMPEDANCE MISMATCH
The object-relational impedance mismatch is a set of conceptual and technical difficulties that are often
encountered when a relational database management system (RDBMS) is being used by a program written
in an object-oriented programming language or style; particularly when objects or class definitions are
mapped in a straightforward way to database tables or relational schema.
OBJECT-RELATIONAL IMPEDANCE MISMATCH
'Object-Relational Impedance Mismatch' is just a fancy way of saying that object models and relational
models do not work very well together. RDBMSs represent data in a tabular format , whereas object-
oriented languages, such as Java, C# represent it as an interconnected graph of objects. Loading and
storing graphs of objects using a tabular relational database exposes us to 5 mismatch problems
• Granularity
• Subtypes (inheritance)
• Identity
• Associations
• Data Types
GRANULARITY
Sometimes you will have an object model which has more classes than the number of corresponding
tables in the database
public class Teacher{
}
public class School{
}
SUBTYPES (INHERITANCE)
• Inheritance is a natural paradigm in object-oriented programming languages. However, RDBMSs do not
define anything similar to Inheritance
Human
Man Woman
Inheritance
IDENTITY
• A RDBMS defines exactly one notion of 'sameness‘
• Java, however, defines both object identity a==b and object equality a. equals(b) .
ASSOCIATIONS & DATA NAVIGATION
• Associations are represented as unidirectional references in Object Oriented languages whereas
RDBMSs use the notion of foreign keys. If you need bidirectional relationships in C#, you must define
the association twice
• The way you access data in Java or C# is fundamentally different than the way you do it in a relational
database. In Java or C# you navigate from one association to an other walking the object network.
Class user_main {
Teacher teacher;
}
Class Teacher {
}
DATA TYPES
• When we consider about data types there a mismatches, simply String might have limited size than a
varchar data type
• String Varchar(150)
• Mismatches Between Date and time in the object world and the relational world
ORM COMPONENTS
1. Mapping
2. Reflection, Projection and Hydration
3. SQL Query Builder
4. Fetching
5. Caching and persistence
6. Settings
ORM COMPONENTS : MAPPING
1. Physical (Storage Model) SSDL
2. Logical (Conceptual Model) CSDL
3. Mapping Model MSL
ORM COMPONENTS : SQL QUERY BUILDER
FETCHING
• Basically when you think about it, a class is just another data type.
• However unlike say an int, we really don't want to load it when the rest of the class is loaded.
• we might end up loading our entire database or even end up in an endless loop of loading.
• So what most ORM do to combat this is use something called lazy loading.
• Lazy loading is simply a design pattern where you load/initialize an object only when it is needed.
• Lazy loading Levels
• for the data through relations
• for some columns. When we want to display just a list of names, we don't need all the columns of a table to be
loaded. We may need the blob fields only at certain point, under certain conditions, and so it's better to load
them only at that time.
ORM COMPONENTS : CACHING AND OPTIMIZATIONS
• Lazy loading (the loading of some data is deferred until it's needed)
• for the data through relations
• for some columns. When we want to display just a list of names, we don't need all the columns of a table to be loaded. We may need the blob fields
only at certain point, under certain conditions, and so it's better to load them only at that time.
• Cache dynamically generated queries, so that they don't get rebuilt at each call.
• Cache some data to avoid too many calls to the data source.
• Optimized queries (update only the modified columns; detect situations where the number of executed queries can be reduced; ...)
• Handle circular references without duplication of objects ("account == account.Client.Account")
• Handle cascade updates. Deleting a master record should delete the linked details if wished so.
• Bulk updates or deletions. When we want to update or delete thousands of records at a time, it's not possible to load all the objects
in memory, while this can be easily and quickly done with a SQL query (DELETE FROM Customer WHERE Balance < 0). Support from
the tool is welcome to handle such massive operations without having to deal with SQL. Hibernate is not very good on this point for
example.
ORM COMPONENTS : SETTINGS
• XML
• MetaData
• Database
• File Storage
DISADVANTAGES OF ORM
• ORM adds a least one small layer of application code, potentially increasing processing overhead.
• ORM can load related business objects on demand.
• An ORM system's design might dictate certain database design decisions.
COMPARISON
• http://en.wikipedia.org/wiki/Comparison_of_object-relational_mapping_software
CHOOSING AN ORM TOOL• Be able to use inheritance
• Handle any type of relations (1-1, 1-n, n-n)
• Aggregates (equivalent to SQL's SUM, AVG, MIN, MAX, COUNT)
• Support for grouping (SQL's GROUP BY)
• Support for transactions
• Supported databases.
• Query language (OQL - Object Query Language, OPath).
• Support for DataBinding
• Customization of queries.
• Support any type of SQL joins (inner join, outer join)
• Concurrency management (support for optimistic and pessimistic approaches)
• Support for the data types specific to the database management system (identity columns, sequences,
GUIDs, autoincrements)
• Be able to map a single object to data coming from multiple tables (joins, views).
• Be able to dispatch the data from a single table to multiple objects.
DEMO
WHAT NEXT ?!
• Entity Framework Architecture
• How to use Entity Framework
Q & A
REFERENCES
• http://www.codeproject.com/Articles/17269/Reflection-in-C-Tutorial
• http://csharp.net-tutorials.com/reflection/introduction/
• http://en.wikipedia.org/wiki/Common_Object_Request_Broker_Architecture
• http://en.wikipedia.org/wiki/Object-relational_impedance_mismatch
• http://en.wikipedia.org/wiki/Object_database
• http://www.artima.com/intv/abstract3.html
• http://en.wikipedia.org/wiki/Object-relational_mapping
• http://en.wikipedia.org/wiki/Common_Object_Request_Broker_Architecture
• http://hateraide.codeplex.com/

More Related Content

What's hot

Introduce to XML
Introduce to XMLIntroduce to XML
Introduce to XML
videde_group
 
Heterogenous Persistence
Heterogenous PersistenceHeterogenous Persistence
Heterogenous Persistence
Jervin Real
 
Painless OO XML with XML::Pastor
Painless OO XML with XML::PastorPainless OO XML with XML::Pastor
Painless OO XML with XML::Pastor
joelbernstein
 
Basic Application Performance Optimization Techniques (Backend)
Basic Application Performance Optimization Techniques (Backend)Basic Application Performance Optimization Techniques (Backend)
Basic Application Performance Optimization Techniques (Backend)
Klas Berlič Fras
 
ApacheCon North America 2018: Creating Spark Data Sources
ApacheCon North America 2018: Creating Spark Data SourcesApacheCon North America 2018: Creating Spark Data Sources
ApacheCon North America 2018: Creating Spark Data Sources
Jayesh Thakrar
 
Introduction to Databases
Introduction to DatabasesIntroduction to Databases
Introduction to Databases
Ram Kedem
 
Database2011 MySQL Sharding
Database2011 MySQL ShardingDatabase2011 MySQL Sharding
Database2011 MySQL Sharding
Moshe Kaplan
 
Efficient SPARQL to SQL translation with user defined mapping
Efficient SPARQL to SQL translation with user defined mappingEfficient SPARQL to SQL translation with user defined mapping
Efficient SPARQL to SQL translation with user defined mapping
Miloš Chaloupka
 
Porting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQLPorting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQL
Peter Eisentraut
 
Data Science Salon: A Journey of Deploying a Data Science Engine to Production
Data Science Salon: A Journey of Deploying a Data Science Engine to ProductionData Science Salon: A Journey of Deploying a Data Science Engine to Production
Data Science Salon: A Journey of Deploying a Data Science Engine to Production
Formulatedby
 
Funtional Programming
Funtional ProgrammingFuntional Programming
Funtional Programming
Girish Khanzode
 
NoSQL into E-Commerce: lessons learned
NoSQL into E-Commerce: lessons learnedNoSQL into E-Commerce: lessons learned
NoSQL into E-Commerce: lessons learned
La FeWeb
 
Dynamo db pros and cons
Dynamo db  pros and consDynamo db  pros and cons
Dynamo db pros and consSaniya Khalsa
 
How to Design a Good Database
How to Design a Good DatabaseHow to Design a Good Database
How to Design a Good Database
Nur Hidayat
 
DMDW 11. Student Presentation - JAVA to MongoDB
DMDW 11. Student Presentation - JAVA to MongoDBDMDW 11. Student Presentation - JAVA to MongoDB
DMDW 11. Student Presentation - JAVA to MongoDB
Johannes Hoppe
 
Gluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDBGluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDB
Jeff Douglas
 
DynamoDB Gluecon 2012
DynamoDB Gluecon 2012DynamoDB Gluecon 2012
DynamoDB Gluecon 2012Appirio
 

What's hot (20)

NoSql
NoSqlNoSql
NoSql
 
Introduce to XML
Introduce to XMLIntroduce to XML
Introduce to XML
 
Heterogenous Persistence
Heterogenous PersistenceHeterogenous Persistence
Heterogenous Persistence
 
Painless OO XML with XML::Pastor
Painless OO XML with XML::PastorPainless OO XML with XML::Pastor
Painless OO XML with XML::Pastor
 
Basic Application Performance Optimization Techniques (Backend)
Basic Application Performance Optimization Techniques (Backend)Basic Application Performance Optimization Techniques (Backend)
Basic Application Performance Optimization Techniques (Backend)
 
ApacheCon North America 2018: Creating Spark Data Sources
ApacheCon North America 2018: Creating Spark Data SourcesApacheCon North America 2018: Creating Spark Data Sources
ApacheCon North America 2018: Creating Spark Data Sources
 
Introduction to Databases
Introduction to DatabasesIntroduction to Databases
Introduction to Databases
 
Database2011 MySQL Sharding
Database2011 MySQL ShardingDatabase2011 MySQL Sharding
Database2011 MySQL Sharding
 
Efficient SPARQL to SQL translation with user defined mapping
Efficient SPARQL to SQL translation with user defined mappingEfficient SPARQL to SQL translation with user defined mapping
Efficient SPARQL to SQL translation with user defined mapping
 
Porting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQLPorting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQL
 
Revision
RevisionRevision
Revision
 
Data Science Salon: A Journey of Deploying a Data Science Engine to Production
Data Science Salon: A Journey of Deploying a Data Science Engine to ProductionData Science Salon: A Journey of Deploying a Data Science Engine to Production
Data Science Salon: A Journey of Deploying a Data Science Engine to Production
 
NoSQL databases
NoSQL databasesNoSQL databases
NoSQL databases
 
Funtional Programming
Funtional ProgrammingFuntional Programming
Funtional Programming
 
NoSQL into E-Commerce: lessons learned
NoSQL into E-Commerce: lessons learnedNoSQL into E-Commerce: lessons learned
NoSQL into E-Commerce: lessons learned
 
Dynamo db pros and cons
Dynamo db  pros and consDynamo db  pros and cons
Dynamo db pros and cons
 
How to Design a Good Database
How to Design a Good DatabaseHow to Design a Good Database
How to Design a Good Database
 
DMDW 11. Student Presentation - JAVA to MongoDB
DMDW 11. Student Presentation - JAVA to MongoDBDMDW 11. Student Presentation - JAVA to MongoDB
DMDW 11. Student Presentation - JAVA to MongoDB
 
Gluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDBGluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDB
 
DynamoDB Gluecon 2012
DynamoDB Gluecon 2012DynamoDB Gluecon 2012
DynamoDB Gluecon 2012
 

Similar to ORM Methodology

Some NoSQL
Some NoSQLSome NoSQL
Some NoSQL
Malk Zameth
 
NoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOONoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOOJames Hollingworth
 
NoSQL and MongoDB
NoSQL and MongoDBNoSQL and MongoDB
NoSQL and MongoDB
Rajesh Menon
 
NO SQL: What, Why, How
NO SQL: What, Why, HowNO SQL: What, Why, How
NO SQL: What, Why, HowIgor Moochnick
 
MongoDB 2.4 and spring data
MongoDB 2.4 and spring dataMongoDB 2.4 and spring data
MongoDB 2.4 and spring data
Jimmy Ray
 
Navigating NoSQL in cloudy skies
Navigating NoSQL in cloudy skiesNavigating NoSQL in cloudy skies
Navigating NoSQL in cloudy skies
shnkr_rmchndrn
 
Database Technologies
Database TechnologiesDatabase Technologies
Database Technologies
Michel de Goede
 
Architecture by Accident
Architecture by AccidentArchitecture by Accident
Architecture by Accident
Gleicon Moraes
 
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptxUNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptx
Rahul Borate
 
The tortoise and the ORM
The tortoise and the ORMThe tortoise and the ORM
The tortoise and the ORM
Frikkie van Biljon
 
Cloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure toolsCloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure tools
Pushkar Chivate
 
AWS Cloudformation Session 01
AWS Cloudformation Session 01AWS Cloudformation Session 01
AWS Cloudformation Session 01
AWS Riyadh User Group
 
Domain oriented development
Domain oriented developmentDomain oriented development
Domain oriented development
rajmundr
 
Cassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
Cassandra Community Webinar: From Mongo to Cassandra, Architectural LessonsCassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
Cassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
DataStax
 
MongoDB
MongoDBMongoDB
MongoDB
fsbrooke
 
Nosql databases
Nosql databasesNosql databases
Nosql databases
Fayez Shayeb
 
PASS Summit 2020
PASS Summit 2020PASS Summit 2020
PASS Summit 2020
Kellyn Pot'Vin-Gorman
 
Entity framework introduction sesion-1
Entity framework introduction   sesion-1Entity framework introduction   sesion-1
Entity framework introduction sesion-1
Usama Nada
 

Similar to ORM Methodology (20)

Some NoSQL
Some NoSQLSome NoSQL
Some NoSQL
 
NoSQL
NoSQLNoSQL
NoSQL
 
NoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOONoSQL and CouchDB: the view from MOO
NoSQL and CouchDB: the view from MOO
 
NoSQL and MongoDB
NoSQL and MongoDBNoSQL and MongoDB
NoSQL and MongoDB
 
NO SQL: What, Why, How
NO SQL: What, Why, HowNO SQL: What, Why, How
NO SQL: What, Why, How
 
MongoDB 2.4 and spring data
MongoDB 2.4 and spring dataMongoDB 2.4 and spring data
MongoDB 2.4 and spring data
 
Navigating NoSQL in cloudy skies
Navigating NoSQL in cloudy skiesNavigating NoSQL in cloudy skies
Navigating NoSQL in cloudy skies
 
Database Technologies
Database TechnologiesDatabase Technologies
Database Technologies
 
Architecture by Accident
Architecture by AccidentArchitecture by Accident
Architecture by Accident
 
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptxUNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptx
 
The tortoise and the ORM
The tortoise and the ORMThe tortoise and the ORM
The tortoise and the ORM
 
Cloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure toolsCloud architectural patterns and Microsoft Azure tools
Cloud architectural patterns and Microsoft Azure tools
 
AWS Cloudformation Session 01
AWS Cloudformation Session 01AWS Cloudformation Session 01
AWS Cloudformation Session 01
 
Domain oriented development
Domain oriented developmentDomain oriented development
Domain oriented development
 
Oodb
OodbOodb
Oodb
 
Cassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
Cassandra Community Webinar: From Mongo to Cassandra, Architectural LessonsCassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
Cassandra Community Webinar: From Mongo to Cassandra, Architectural Lessons
 
MongoDB
MongoDBMongoDB
MongoDB
 
Nosql databases
Nosql databasesNosql databases
Nosql databases
 
PASS Summit 2020
PASS Summit 2020PASS Summit 2020
PASS Summit 2020
 
Entity framework introduction sesion-1
Entity framework introduction   sesion-1Entity framework introduction   sesion-1
Entity framework introduction sesion-1
 

Recently uploaded

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 

Recently uploaded (20)

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 

ORM Methodology

  • 1. ORM METHODOLOGY AHMED GOMAA LEAD SOFTWARE ENGINEER GOMAA86@GMAIL.COM
  • 2. OUTLINES 1. What is ORM ?! 2. Why ORM ?! 3. What is CORBA ? 4. Problem: Object-relational impedance mismatch 5. ORM Components and Architecture 6. Disadvantages of ORM 7. Comparison 8. Choosing an ORM tool 9. Demonstration of ORM using Micro ORM 10. What Next ?! 11. Q & A 12. References
  • 3. WHAT IS ORM ?! in computer science is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language.
  • 4. WHY ORM ?! • Speeds-up Development - eliminates the need for repetitive SQL code. • Reduces Development Time. • Reduces Development Costs. • Overcomes vendor specific SQL differences - the ORM knows how to write vendor specific SQL so you don't have to. • Rich query capability. ORM tools provide an object oriented query language.
  • 5. WHAT IS CORBA ?! • Common Object Request Broker Architecture (CORBA) • A standard defined by the Object Management Group (OMG) designed to facilitate the communication of systems that are deployed on diverse platforms. • Enables collaboration between systems on different operating systems, programming languages, and computing hardware. • CORBA has many of the same design goals as object-oriented programming: encapsulation and reuse. • CORBA uses an object-oriented model although the systems that utilize CORBA do not have to be object-oriented.
  • 6. OBJECT-RELATIONAL IMPEDANCE MISMATCH The object-relational impedance mismatch is a set of conceptual and technical difficulties that are often encountered when a relational database management system (RDBMS) is being used by a program written in an object-oriented programming language or style; particularly when objects or class definitions are mapped in a straightforward way to database tables or relational schema.
  • 7. OBJECT-RELATIONAL IMPEDANCE MISMATCH 'Object-Relational Impedance Mismatch' is just a fancy way of saying that object models and relational models do not work very well together. RDBMSs represent data in a tabular format , whereas object- oriented languages, such as Java, C# represent it as an interconnected graph of objects. Loading and storing graphs of objects using a tabular relational database exposes us to 5 mismatch problems • Granularity • Subtypes (inheritance) • Identity • Associations • Data Types
  • 8. GRANULARITY Sometimes you will have an object model which has more classes than the number of corresponding tables in the database public class Teacher{ } public class School{ }
  • 9. SUBTYPES (INHERITANCE) • Inheritance is a natural paradigm in object-oriented programming languages. However, RDBMSs do not define anything similar to Inheritance Human Man Woman Inheritance
  • 10. IDENTITY • A RDBMS defines exactly one notion of 'sameness‘ • Java, however, defines both object identity a==b and object equality a. equals(b) .
  • 11. ASSOCIATIONS & DATA NAVIGATION • Associations are represented as unidirectional references in Object Oriented languages whereas RDBMSs use the notion of foreign keys. If you need bidirectional relationships in C#, you must define the association twice • The way you access data in Java or C# is fundamentally different than the way you do it in a relational database. In Java or C# you navigate from one association to an other walking the object network. Class user_main { Teacher teacher; } Class Teacher { }
  • 12. DATA TYPES • When we consider about data types there a mismatches, simply String might have limited size than a varchar data type • String Varchar(150) • Mismatches Between Date and time in the object world and the relational world
  • 13. ORM COMPONENTS 1. Mapping 2. Reflection, Projection and Hydration 3. SQL Query Builder 4. Fetching 5. Caching and persistence 6. Settings
  • 14. ORM COMPONENTS : MAPPING 1. Physical (Storage Model) SSDL 2. Logical (Conceptual Model) CSDL 3. Mapping Model MSL
  • 15.
  • 16. ORM COMPONENTS : SQL QUERY BUILDER
  • 17. FETCHING • Basically when you think about it, a class is just another data type. • However unlike say an int, we really don't want to load it when the rest of the class is loaded. • we might end up loading our entire database or even end up in an endless loop of loading. • So what most ORM do to combat this is use something called lazy loading. • Lazy loading is simply a design pattern where you load/initialize an object only when it is needed. • Lazy loading Levels • for the data through relations • for some columns. When we want to display just a list of names, we don't need all the columns of a table to be loaded. We may need the blob fields only at certain point, under certain conditions, and so it's better to load them only at that time.
  • 18. ORM COMPONENTS : CACHING AND OPTIMIZATIONS • Lazy loading (the loading of some data is deferred until it's needed) • for the data through relations • for some columns. When we want to display just a list of names, we don't need all the columns of a table to be loaded. We may need the blob fields only at certain point, under certain conditions, and so it's better to load them only at that time. • Cache dynamically generated queries, so that they don't get rebuilt at each call. • Cache some data to avoid too many calls to the data source. • Optimized queries (update only the modified columns; detect situations where the number of executed queries can be reduced; ...) • Handle circular references without duplication of objects ("account == account.Client.Account") • Handle cascade updates. Deleting a master record should delete the linked details if wished so. • Bulk updates or deletions. When we want to update or delete thousands of records at a time, it's not possible to load all the objects in memory, while this can be easily and quickly done with a SQL query (DELETE FROM Customer WHERE Balance < 0). Support from the tool is welcome to handle such massive operations without having to deal with SQL. Hibernate is not very good on this point for example.
  • 19. ORM COMPONENTS : SETTINGS • XML • MetaData • Database • File Storage
  • 20. DISADVANTAGES OF ORM • ORM adds a least one small layer of application code, potentially increasing processing overhead. • ORM can load related business objects on demand. • An ORM system's design might dictate certain database design decisions.
  • 22. CHOOSING AN ORM TOOL• Be able to use inheritance • Handle any type of relations (1-1, 1-n, n-n) • Aggregates (equivalent to SQL's SUM, AVG, MIN, MAX, COUNT) • Support for grouping (SQL's GROUP BY) • Support for transactions • Supported databases. • Query language (OQL - Object Query Language, OPath). • Support for DataBinding • Customization of queries. • Support any type of SQL joins (inner join, outer join) • Concurrency management (support for optimistic and pessimistic approaches) • Support for the data types specific to the database management system (identity columns, sequences, GUIDs, autoincrements) • Be able to map a single object to data coming from multiple tables (joins, views). • Be able to dispatch the data from a single table to multiple objects.
  • 23. DEMO
  • 24. WHAT NEXT ?! • Entity Framework Architecture • How to use Entity Framework
  • 25. Q & A
  • 26. REFERENCES • http://www.codeproject.com/Articles/17269/Reflection-in-C-Tutorial • http://csharp.net-tutorials.com/reflection/introduction/ • http://en.wikipedia.org/wiki/Common_Object_Request_Broker_Architecture • http://en.wikipedia.org/wiki/Object-relational_impedance_mismatch • http://en.wikipedia.org/wiki/Object_database • http://www.artima.com/intv/abstract3.html • http://en.wikipedia.org/wiki/Object-relational_mapping • http://en.wikipedia.org/wiki/Common_Object_Request_Broker_Architecture • http://hateraide.codeplex.com/

Editor's Notes

  1. What is ORM ?! Many object-oriented applications created today, use relational databases for persistence. There is a straight forward correspondence between database tables and application classes. Developers usually write a great deal of code to connect to and query the database
  2. When we work with an object-oriented systems, there's a mismatch between the object model and the relational database. RDBMSs represent data in a tabular format whereas object-oriented languages (Java or C#) represent it as an interconnected graph of objects.
  3. Granularity Sometimes you will have an object model which has more classes than the number of corresponding tables in the database (we say the object model is more granular than the relational model). Take for example the notion of an Address… Subtypes (inheritance) Inheritance is a natural paradigm in object-oriented programming languages. However, RDBMSs do not define anything similar on the whole (yes some databases do have subtype support but it is completely no standardized)… Identity A RDBMS defines exactly one notion of sameness: the primary key. Java, however, defines both object identity a==b and object equality a. equals(b) . Associations Associations are represented as unidirectional references in Object Oriented languages whereas RDBMSs use the notion of foreign keys. If you need bidirectional relationships in Java, you must define the association twice. Likewise, you cannot determine the multiplicity of a relationship by looking at the object domain model. Data navigation The way you access data in Java is fundamentally different than the way you do it in a relational database. In Java, you navigate from one association to an other walking the object network.
  4. Granularity Sometimes you will have an object model which has more classes than the number of corresponding tables in the database (we say the object model is more granular than the relational model). Take for example the notion of an Address… Subtypes (inheritance) Inheritance is a natural paradigm in object-oriented programming languages. However, RDBMSs do not define anything similar on the whole (yes some databases do have subtype support but it is completely no standardized)… Identity A RDBMS defines exactly one notion of sameness: the primary key. Java, however, defines both object identity a==b and object equality a. equals(b) . Associations Associations are represented as unidirectional references in Object Oriented languages whereas RDBMSs use the notion of foreign keys. If you need bidirectional relationships in Java, you must define the association twice. Likewise, you cannot determine the multiplicity of a relationship by looking at the object domain model. Data navigation The way you access data in Java is fundamentally different than the way you do it in a relational database. In Java, you navigate from one association to an other walking the object network.
  5. Granularity Sometimes you will have an object model which has more classes than the number of corresponding tables in the database (we say the object model is more granular than the relational model). Take for example the notion of an
  6. Subtypes (inheritance) Inheritance is a natural paradigm in object-oriented programming languages. However, RDBMSs do not define anything similar on the whole (yes some databases do have subtype support but it is completely no standardized)…
  7. A RDBMS defines exactly one notion of sameness: the primary key. Java, however, defines both object identity a==b and object equality a. equals(b) .
  8. Associations Associations are represented as unidirectional references in Object Oriented languages whereas RDBMSs use the notion of foreign keys. If you need bidirectional relationships in Java, you must define the association twice. Likewise, you cannot determine the multiplicity of a relationship by looking at the object domain model.
  9. Data navigation The way you access data in Java is fundamentally different than the way you do it in a relational database. In Java, you navigate from one association to an other walking the object network.
  10. There are two sections that check if the attribute type is a mapping. The first section defines an ID field (the ID of the mapped class will go there when we load it). The second section is the actual code for getting the object. It checks whether the object is null, if it is null it loads the object and saves it for later (by creating a session object and simply calling Select), however if it is still null it creates a default object.
  11. All of these O/R mappings usually live and die by whether they are flexible enough in their caching policies, and most of them are not. We've actually tried hard in .NET to make sure that the caching policy can be entirely under your control, or entirely non-existent. In many cases, you just want to fire up a query and suck down the results. You'd like to use the results as objects, but you don't want the infrastructure to try to cache them so that if you ask for that object again you get the same exact object. A lot of systems can only operate that way, and as a result, they have horrible performance overheads that you often just don't need. On a middle-tier, for example, you quite often don't care about caching, because you're just serving some incoming HTTP request that's immediately going to go away thereafter. So why cache?