SlideShare a Scribd company logo
Why Hibernate? Learning By Evolution Presented by 4 Circles LLC 4 Circles  Copyright
Pre ORM ORM – Object Relational Mapping. This is the main concept in Hibernate.  In a typical environment, we have the usual n-tier architecture as shown v1.01  copyright 4 Circles
Pre ORM In a standard Model View Controller (MVC) architecture the ‘mapping of the objects’ was done by the Controller.  The majority of all work done is retrieiving data from databases to the view. While retrieving of data can be done using native database SQL the data which is shown in the view is different. Here we say ‘mapping of the objects’.  v1.01  copyright 4 Circles
Pre ORM Disadvantages Everyone wrote their own mapping of objects in each controller for the same table.  Maintenance was not easy.  Table changes then all the code needs to change to map correctly the objects.  Same programmer had to do the same mapping for another application with the same table v1.01  copyright 4 Circles
Object Relational Mapping Complicated applications required more programmers to share their code.  In the early 2000s, each programmer wrote their own ORM tool, e.g.   <orm> <table name=“employee” object=“EmployeeDTO”>   <column name=“id” field=“employeeId”/> <column name=“fname” field=“firstname”/> <column name=“lname” field=“lastname”/> </table> </orm> As can been seen above to read the above XML we need one class and generate the objects to send to the view.  This can be extended to many tables without loss of generality.  Easy to maintain.  v1.01  copyright 4 Circles
Object Relational Mapping This method was good however, not standardized thru the industry.  As each new programmer came on board a new project you had different flavors of home-grown ORMs in the same application.  A few people got together and came up with Hibernate to work on JDK 1.4.x. They put some standards and got the engine to map the table to the objects in the same way we saw in the previous slide.  Disadvantages of XML file: If the code changes then the xml file need to updated and vice-versa. Specifically when we add a new column then the java file and the xml file need to be updated.  Not self-contained.  v1.01  copyright 4 Circles
JPA with Hibernate  With JDK1.5.x, the concept of annotations was introduced and with that Java Persistence Annotations (JPA) were introduced.  JPA then eliminated the need to have an XML file to map the columns to each object’s member variable.  v1.01  copyright 4 Circles
A Simple Example package com.fourcircles.learning.jpa; @Entity @NamedNativeQuery(name = SimpleEntity.QUERY_BY_SIC_CODE, query = &quot; SELECT &quot; +  b.FTA_CODE AS fta_code, b.DIVISION_NM AS division_name, b.Company_name as office_name, b.MKT AS market_name,   &quot; NVL(b.FTA_DESCRIPTION, 'UNKNOWN') AS fta_description, b.BILLING_SYSTEM_NAME AS billing_system_name&quot; + &quot; FROM busmap.busmap_fin_hierarchy@busmap b WHERE &quot;+   &quot;  ( length(fta_code) > 8  AND b.SIC_CODE = :&quot;+ SimpleExample.SIC_CODE, resultSetMapping=&quot;companyMapping&quot; ) @SqlResultSetMapping(name = &quot;marketMapping&quot;,  entities = { @EntityResult(entityClass = com.fourcircles.learning.jpa.SimpleExample.class, fields = { @FieldResult(name = &quot;ftaCode&quot;, column = &quot;fta_code&quot;), @FieldResult(name = &quot;divisionName&quot;, column = &quot;division_name&quot;), @FieldResult(name = &quot;companyName&quot;, column = &quot;company_name&quot;), @FieldResult(name = &quot;marketName&quot;, column = &quot;market_name&quot;), @FieldResult(name = &quot;ftaDescription&quot;, column = &quot;fta_description&quot;), @FieldResult(name = &quot;billingSystemName&quot;, column = &quot;billing_system_name&quot;) }) }) public class SimpleExample { public final static String QUERY_BY_SIC_CODE = “infoBySICCode&quot;; public final static String QUERY_PARM_FTA_CODE = “sicCode&quot;; @Id private String ftaCode; private String divisionName; private String marketName; private String companyName; private String ftaDescription; private String billingSystemName; public MarketDTO() { public void setOfficeName(String companyName) { this.companyName = companyName; } } v1.01  copyright 4 Circles

More Related Content

PPT
Create and analyse programs
PPT
oracle-reports6i
PPTX
OPERATOR OVERLOADING IN C++
PPT
Siebel eScript
PPT
NEOOUG 2010 Oracle Data Integrator Presentation
PPTX
Operator overloading
PPT
Language Integrated Query - LINQ
PPT
Lec 26.27-operator overloading
Create and analyse programs
oracle-reports6i
OPERATOR OVERLOADING IN C++
Siebel eScript
NEOOUG 2010 Oracle Data Integrator Presentation
Operator overloading
Language Integrated Query - LINQ
Lec 26.27-operator overloading

What's hot (20)

PDF
PPTX
Operator overloading
PPT
Rendering XML Document
PDF
Alv for web
PPT
Operator overloading
PDF
.NET Core, ASP.NET Core Course, Session 13
ODP
Functors, Applicatives and Monads In Scala
PPTX
Knockoutjs Part 3 Computed Observables
PDF
.NET Core, ASP.NET Core Course, Session 16
PDF
.NET Core, ASP.NET Core Course, Session 14
PPTX
Presentation on overloading
PPT
Les17[1] Writing Executable Statements
PPTX
Function different types of funtion
PPT
C++ overloading
PDF
Operator overloading
PPTX
Operator overloadng
PPT
Operator overloading
PDF
.NET Core, ASP.NET Core Course, Session 11
PDF
Context at design
ODP
Xml processing in scala
Operator overloading
Rendering XML Document
Alv for web
Operator overloading
.NET Core, ASP.NET Core Course, Session 13
Functors, Applicatives and Monads In Scala
Knockoutjs Part 3 Computed Observables
.NET Core, ASP.NET Core Course, Session 16
.NET Core, ASP.NET Core Course, Session 14
Presentation on overloading
Les17[1] Writing Executable Statements
Function different types of funtion
C++ overloading
Operator overloading
Operator overloadng
Operator overloading
.NET Core, ASP.NET Core Course, Session 11
Context at design
Xml processing in scala
Ad

Similar to Why hibernater1 (20)

PDF
Hibernate using jpa
PDF
Introduction to JPA and Hibernate including examples
PPT
PDF
JPA and Hibernate
PPT
Patni Hibernate
PPT
Hibernate
PPT
PDF
Free Hibernate Tutorial | VirtualNuggets
PPT
Basic Hibernate Final
PDF
Java persistence api 2.1
PPTX
Hibernate Training Session1
PPTX
Hibernate example1
PPTX
Module-3 for career and JFSD ppt for study.pptx
PPTX
L16 Object Relational Mapping and NoSQL
PPTX
Hibernate ppt
ODP
Java Persistence API
PPTX
Hibernate in XPages
PPTX
Hibernate_ORM_JPA Hibernate_ORM_JPA.pptx
PPTX
Introduction to Hibernate Framework
PPTX
Introduction to Hibernate Framework
Hibernate using jpa
Introduction to JPA and Hibernate including examples
JPA and Hibernate
Patni Hibernate
Hibernate
Free Hibernate Tutorial | VirtualNuggets
Basic Hibernate Final
Java persistence api 2.1
Hibernate Training Session1
Hibernate example1
Module-3 for career and JFSD ppt for study.pptx
L16 Object Relational Mapping and NoSQL
Hibernate ppt
Java Persistence API
Hibernate in XPages
Hibernate_ORM_JPA Hibernate_ORM_JPA.pptx
Introduction to Hibernate Framework
Introduction to Hibernate Framework
Ad

Recently uploaded (20)

PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
GDM (1) (1).pptx small presentation for students
PDF
RMMM.pdf make it easy to upload and study
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
master seminar digital applications in india
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Institutional Correction lecture only . . .
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
GDM (1) (1).pptx small presentation for students
RMMM.pdf make it easy to upload and study
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
TR - Agricultural Crops Production NC III.pdf
Renaissance Architecture: A Journey from Faith to Humanism
O7-L3 Supply Chain Operations - ICLT Program
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Final Presentation General Medicine 03-08-2024.pptx
Microbial diseases, their pathogenesis and prophylaxis
master seminar digital applications in india
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Microbial disease of the cardiovascular and lymphatic systems
STATICS OF THE RIGID BODIES Hibbelers.pdf
Cell Types and Its function , kingdom of life
O5-L3 Freight Transport Ops (International) V1.pdf
Institutional Correction lecture only . . .

Why hibernater1

  • 1. Why Hibernate? Learning By Evolution Presented by 4 Circles LLC 4 Circles Copyright
  • 2. Pre ORM ORM – Object Relational Mapping. This is the main concept in Hibernate. In a typical environment, we have the usual n-tier architecture as shown v1.01 copyright 4 Circles
  • 3. Pre ORM In a standard Model View Controller (MVC) architecture the ‘mapping of the objects’ was done by the Controller. The majority of all work done is retrieiving data from databases to the view. While retrieving of data can be done using native database SQL the data which is shown in the view is different. Here we say ‘mapping of the objects’. v1.01 copyright 4 Circles
  • 4. Pre ORM Disadvantages Everyone wrote their own mapping of objects in each controller for the same table. Maintenance was not easy. Table changes then all the code needs to change to map correctly the objects. Same programmer had to do the same mapping for another application with the same table v1.01 copyright 4 Circles
  • 5. Object Relational Mapping Complicated applications required more programmers to share their code. In the early 2000s, each programmer wrote their own ORM tool, e.g. <orm> <table name=“employee” object=“EmployeeDTO”> <column name=“id” field=“employeeId”/> <column name=“fname” field=“firstname”/> <column name=“lname” field=“lastname”/> </table> </orm> As can been seen above to read the above XML we need one class and generate the objects to send to the view. This can be extended to many tables without loss of generality. Easy to maintain. v1.01 copyright 4 Circles
  • 6. Object Relational Mapping This method was good however, not standardized thru the industry. As each new programmer came on board a new project you had different flavors of home-grown ORMs in the same application. A few people got together and came up with Hibernate to work on JDK 1.4.x. They put some standards and got the engine to map the table to the objects in the same way we saw in the previous slide. Disadvantages of XML file: If the code changes then the xml file need to updated and vice-versa. Specifically when we add a new column then the java file and the xml file need to be updated. Not self-contained. v1.01 copyright 4 Circles
  • 7. JPA with Hibernate With JDK1.5.x, the concept of annotations was introduced and with that Java Persistence Annotations (JPA) were introduced. JPA then eliminated the need to have an XML file to map the columns to each object’s member variable. v1.01 copyright 4 Circles
  • 8. A Simple Example package com.fourcircles.learning.jpa; @Entity @NamedNativeQuery(name = SimpleEntity.QUERY_BY_SIC_CODE, query = &quot; SELECT &quot; + b.FTA_CODE AS fta_code, b.DIVISION_NM AS division_name, b.Company_name as office_name, b.MKT AS market_name, &quot; NVL(b.FTA_DESCRIPTION, 'UNKNOWN') AS fta_description, b.BILLING_SYSTEM_NAME AS billing_system_name&quot; + &quot; FROM busmap.busmap_fin_hierarchy@busmap b WHERE &quot;+ &quot; ( length(fta_code) > 8 AND b.SIC_CODE = :&quot;+ SimpleExample.SIC_CODE, resultSetMapping=&quot;companyMapping&quot; ) @SqlResultSetMapping(name = &quot;marketMapping&quot;, entities = { @EntityResult(entityClass = com.fourcircles.learning.jpa.SimpleExample.class, fields = { @FieldResult(name = &quot;ftaCode&quot;, column = &quot;fta_code&quot;), @FieldResult(name = &quot;divisionName&quot;, column = &quot;division_name&quot;), @FieldResult(name = &quot;companyName&quot;, column = &quot;company_name&quot;), @FieldResult(name = &quot;marketName&quot;, column = &quot;market_name&quot;), @FieldResult(name = &quot;ftaDescription&quot;, column = &quot;fta_description&quot;), @FieldResult(name = &quot;billingSystemName&quot;, column = &quot;billing_system_name&quot;) }) }) public class SimpleExample { public final static String QUERY_BY_SIC_CODE = “infoBySICCode&quot;; public final static String QUERY_PARM_FTA_CODE = “sicCode&quot;; @Id private String ftaCode; private String divisionName; private String marketName; private String companyName; private String ftaDescription; private String billingSystemName; public MarketDTO() { public void setOfficeName(String companyName) { this.companyName = companyName; } } v1.01 copyright 4 Circles