SlideShare a Scribd company logo
Hibernate An object-relational mapping solution for Java
Buzz Words Persistence  O/R Mapping  ( Object-Relational mapping  )
What Is Persistence ? The storage of an object on a disk or other permanent storage device or data that exists from session to session as opposed to transient data Persistent data typically implies that it is  durable  (i.e. will survive a crash or shutdown of the process) usually with some guarantee of integrity Persistence generally implies use of a database One could use the file system (with suitably careful procedures)
Persistence Class Default constructor Get/set pairs Collection property is an interface type Identifier property public class AuctionItem { private Long _id; private Set _bids; private Bid _successfulBid private String _description; public Long getId() { return  _id; } private void setId(Long id) { _id = id; } public String getDescription() { return _description; } public void setDescription(String desc) { _description=desc; } … }
O/R Mapping  Object-Relational mapping  (aka  O/RM ,  ORM , and  O/R mapping ), is a  programming  technique for converting data between incompatible type systems in databases and  Object-oriented  programming languages. In effect, this creates a "virtual  object database " which can be used from within the programming language. There are both free and commercial packages available that perform object-relational mapping, although some programmers opt to create their own ORM tools.
O/R Mapping  Most business database applications use relational databases Need to map the objects in the application to tables in the database Sometimes be a simple matter of mapping individual classes to separate database tables However, if the class structure is more complex, then the mapping must be carefully considered to allow data to be represented and accessed as efficiently as possible
Object Relational Mapping
O/R Mapping  . JavaObject int id; String name; String getName() int getId() void setName(String) void setId(int) SQL Table id [number] primary key, name [varchar(50)] Magic Happens Here (O/R Mapper – i.e. Hibernate)
Who, What, When Officially maintained by Jboss, Inc, started in December, 2001. Hibernate is an object-relational mapping (ORM) solution for the Java language. It is free, open source software that is distributed under the GNU Lesser General Public License. It provides an easy to use framework for mapping an object-oriented domain model to a traditional relational database.
History is Awesome! Hibernate was developed by a team of Java software developers around the world led by Gavin King. JBoss Group (now part of Red Hat) later hired the lead Hibernate developers and worked with them in supporting Hibernate. This move brought Hibernate development under Java EE Specifications. The current version of Hibernate is Version 3.1, which enriched the platform with new features like a new Interceptor/Callback architecture, user defined filters, and JDK 5.0 Annotations (Java's metadata feature). Hibernate 3 is also very close to the EJB 3.0 specification (although it was finished before the EJB 3.0 specification was released by the Java Community Process) and serves as the backbone for the EJB 3.0 implementation of JBoss.
Architecture Hibernate basically sits between the DB and your code Can map persistent objects to tables
Why Hibernate ? The purpose of Hibernate is to relieve the developer from a significant amount of common data persistence-related programming tasks. Hibernate adapts to the developer's development process, whether starting from scratch or from a legacy database.  Minimize database access with smart fetching strategies Opportunities for aggressive caching Structural  mapping more robust when object/data model changes
Why Hibernate ? Minimizes Code Does not require a container Model is not tied to persistence implementation
Features  Hibernate not only takes care of the mapping from Java classes to database tables (and from Java data types to SQL data types), but also provides data query and retrieval facilities and can significantly reduce development time otherwise spent with manual data handling in SQL and JDBC. Hibernate generates the SQL calls and relieves the developer from manual result set handling and object conversion, keeping the application portable to all SQL databases.
Features  HibernateDaoSupport – superclass, easy HibernateTemplate access Database independence - sits between the database and your java code, easy database switch without changing any code Object / Relational Mapping (ORM) - Allows a developer to treat a database like a collection of Java objects Object oriented query language (HQL) - *Portable* query language, supports polymorphic queries etc. You can also still issue native SQL, and also queries by “Criteria” (specified using “parse tree” of Java objects) Hibernate Mapping - Uses HBM XML files to map value objects (POJOs) to database tables  Transparent persistence - Allows easy saves/delete/retrieve for simple value objects Very high performance “in general” due to intelligent (2-level) caching, although in a few cases hand-written SQL might beat it
Hibernate's Goal Remove 95% of common data persistence problems
Advantages  Support for Query Language Database Dependent Code Maintenance Cost Optimize Performance Automatic Versioning and Time Stamping  Open-Source, Zero-Cost Product License Scalable
Disadvantages Steep Learning Curve Use of Hibernate is an overhead for the applications which are : •  simple and use one database that never change  •  need to put data to database tables, no further SQL queries  •  there are no objects which are mapped to two different tables Hibernate increases extra layers and complexity. So for these types of applications JDBC is the best choice.
Disadvantages Support for Hibernate on Internet is not sufficient. Hibernate does not allow some type of queries which are supported by JDBC. For example It does not allow to insert multiple objects (persistent data) to same table using single query. Developer has to write separate query to insert each object.
Ad

More Related Content

What's hot (20)

enterprise java bean
enterprise java beanenterprise java bean
enterprise java bean
Jitender Singh Lodhi
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
Jeevesh Pandey
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
Purbarun Chakrabarti
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
Vikas Jagtap
 
Spring Boot Tutorial
Spring Boot TutorialSpring Boot Tutorial
Spring Boot Tutorial
Naphachara Rattanawilai
 
Java Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepJava Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By Step
Guo Albert
 
Hibernate
HibernateHibernate
Hibernate
VISHAL DONGA
 
Spring Boot
Spring BootSpring Boot
Spring Boot
Jiayun Zhou
 
Java collections concept
Java collections conceptJava collections concept
Java collections concept
kumar gaurav
 
Hibernate presentation
Hibernate presentationHibernate presentation
Hibernate presentation
Manav Prasad
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
Dzmitry Naskou
 
Spring boot
Spring bootSpring boot
Spring boot
Gyanendra Yadav
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
Serhat Can
 
Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)
Pooja Talreja
 
Java And Multithreading
Java And MultithreadingJava And Multithreading
Java And Multithreading
Shraddha
 
Spring Framework - Spring Security
Spring Framework - Spring SecuritySpring Framework - Spring Security
Spring Framework - Spring Security
Dzmitry Naskou
 
Spring ppt
Spring pptSpring ppt
Spring ppt
Mumbai Academisc
 
JPA For Beginner's
JPA For Beginner'sJPA For Beginner's
JPA For Beginner's
NarayanaMurthy Ganashree
 
Java Collections
Java  Collections Java  Collections
Java Collections
Kongu Engineering College, Perundurai, Erode
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
Nitin Pai
 

Viewers also liked (13)

Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To Hibernate
Amit Himani
 
Cấu hình Hibernate
Cấu hình HibernateCấu hình Hibernate
Cấu hình Hibernate
Minh Quang
 
iBATIS
iBATISiBATIS
iBATIS
techmonkey4u
 
Hướng dẫn lập trình java hibernate cho người mới bắt đầu
Hướng dẫn lập trình java hibernate cho người mới bắt đầuHướng dẫn lập trình java hibernate cho người mới bắt đầu
Hướng dẫn lập trình java hibernate cho người mới bắt đầu
Thành Phạm Đức
 
Java J2EE Interview Questions Part 2
Java J2EE Interview Questions Part 2Java J2EE Interview Questions Part 2
Java J2EE Interview Questions Part 2
javatrainingonline
 
Hibernate presentation
Hibernate presentationHibernate presentation
Hibernate presentation
Luis Goldster
 
Hibernate architecture
Hibernate architectureHibernate architecture
Hibernate architecture
Anurag
 
Java J2EE Interview Questions Part-1
Java J2EE Interview Questions Part-1Java J2EE Interview Questions Part-1
Java J2EE Interview Questions Part-1
javatrainingonline
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examples
ecosio GmbH
 
Introduction to hibernate
Introduction to hibernateIntroduction to hibernate
Introduction to hibernate
hr1383
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types ppt
kamal kotecha
 
Introduction to Hibernate Framework
Introduction to Hibernate FrameworkIntroduction to Hibernate Framework
Introduction to Hibernate Framework
Phuoc Nguyen
 
Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To Hibernate
Amit Himani
 
Cấu hình Hibernate
Cấu hình HibernateCấu hình Hibernate
Cấu hình Hibernate
Minh Quang
 
Hướng dẫn lập trình java hibernate cho người mới bắt đầu
Hướng dẫn lập trình java hibernate cho người mới bắt đầuHướng dẫn lập trình java hibernate cho người mới bắt đầu
Hướng dẫn lập trình java hibernate cho người mới bắt đầu
Thành Phạm Đức
 
Java J2EE Interview Questions Part 2
Java J2EE Interview Questions Part 2Java J2EE Interview Questions Part 2
Java J2EE Interview Questions Part 2
javatrainingonline
 
Hibernate presentation
Hibernate presentationHibernate presentation
Hibernate presentation
Luis Goldster
 
Hibernate architecture
Hibernate architectureHibernate architecture
Hibernate architecture
Anurag
 
Java J2EE Interview Questions Part-1
Java J2EE Interview Questions Part-1Java J2EE Interview Questions Part-1
Java J2EE Interview Questions Part-1
javatrainingonline
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examples
ecosio GmbH
 
Introduction to hibernate
Introduction to hibernateIntroduction to hibernate
Introduction to hibernate
hr1383
 
Jdbc architecture and driver types ppt
Jdbc architecture and driver types pptJdbc architecture and driver types ppt
Jdbc architecture and driver types ppt
kamal kotecha
 
Introduction to Hibernate Framework
Introduction to Hibernate FrameworkIntroduction to Hibernate Framework
Introduction to Hibernate Framework
Phuoc Nguyen
 
Ad

Similar to Hibernate (20)

Free Hibernate Tutorial | VirtualNuggets
Free Hibernate Tutorial  | VirtualNuggetsFree Hibernate Tutorial  | VirtualNuggets
Free Hibernate Tutorial | VirtualNuggets
Virtual Nuggets
 
Hibernate(H8) In Action
Hibernate(H8) In ActionHibernate(H8) In Action
Hibernate(H8) In Action
Priyank
 
Hibernate
HibernateHibernate
Hibernate
Murali Pachiyappan
 
Hibernate 3
Hibernate 3Hibernate 3
Hibernate 3
Rajiv Gupta
 
Hibernate training at HarshithaTechnologySolutions @ Nizampet
Hibernate training at HarshithaTechnologySolutions @ NizampetHibernate training at HarshithaTechnologySolutions @ Nizampet
Hibernate training at HarshithaTechnologySolutions @ Nizampet
Jayarajus
 
What is hibernate?
What is hibernate?What is hibernate?
What is hibernate?
kanchanmahajan23
 
What is hibernate?
What is hibernate?What is hibernate?
What is hibernate?
kanchanmahajan23
 
Java hibernate orm implementation tool
Java hibernate   orm implementation toolJava hibernate   orm implementation tool
Java hibernate orm implementation tool
javaease
 
Hibernate jj
Hibernate jjHibernate jj
Hibernate jj
Joe Jacob
 
Hibernate
HibernateHibernate
Hibernate
Preetha Ganapathi
 
Introduction to Hibernate
Introduction to HibernateIntroduction to Hibernate
Introduction to Hibernate
Krishnakanth Goud
 
Module-3 for career and JFSD ppt for study.pptx
Module-3 for career and JFSD ppt for study.pptxModule-3 for career and JFSD ppt for study.pptx
Module-3 for career and JFSD ppt for study.pptx
ViratKohli78
 
Introduction to odbms
Introduction to odbmsIntroduction to odbms
Introduction to odbms
ajay pashankar
 
Hibernate tutorial
Hibernate tutorialHibernate tutorial
Hibernate tutorial
Mumbai Academisc
 
Rollin onj Rubyv3
Rollin onj Rubyv3Rollin onj Rubyv3
Rollin onj Rubyv3
Oracle
 
What is hibernate?
What is hibernate?What is hibernate?
What is hibernate?
kanchanmahajan23
 
Hibernate training-topics
Hibernate training-topicsHibernate training-topics
Hibernate training-topics
Vibrant Technologies & Computers
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview Questions
Mayank Kumar
 
Hibernate
HibernateHibernate
Hibernate
Mallikarjuna G D
 
Hibernate in Nutshell
Hibernate in NutshellHibernate in Nutshell
Hibernate in Nutshell
Onkar Deshpande
 
Free Hibernate Tutorial | VirtualNuggets
Free Hibernate Tutorial  | VirtualNuggetsFree Hibernate Tutorial  | VirtualNuggets
Free Hibernate Tutorial | VirtualNuggets
Virtual Nuggets
 
Hibernate(H8) In Action
Hibernate(H8) In ActionHibernate(H8) In Action
Hibernate(H8) In Action
Priyank
 
Hibernate training at HarshithaTechnologySolutions @ Nizampet
Hibernate training at HarshithaTechnologySolutions @ NizampetHibernate training at HarshithaTechnologySolutions @ Nizampet
Hibernate training at HarshithaTechnologySolutions @ Nizampet
Jayarajus
 
Java hibernate orm implementation tool
Java hibernate   orm implementation toolJava hibernate   orm implementation tool
Java hibernate orm implementation tool
javaease
 
Hibernate jj
Hibernate jjHibernate jj
Hibernate jj
Joe Jacob
 
Module-3 for career and JFSD ppt for study.pptx
Module-3 for career and JFSD ppt for study.pptxModule-3 for career and JFSD ppt for study.pptx
Module-3 for career and JFSD ppt for study.pptx
ViratKohli78
 
Rollin onj Rubyv3
Rollin onj Rubyv3Rollin onj Rubyv3
Rollin onj Rubyv3
Oracle
 
Hibernate Interview Questions
Hibernate Interview QuestionsHibernate Interview Questions
Hibernate Interview Questions
Mayank Kumar
 
Ad

Recently uploaded (20)

Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 

Hibernate

  • 1. Hibernate An object-relational mapping solution for Java
  • 2. Buzz Words Persistence O/R Mapping ( Object-Relational mapping )
  • 3. What Is Persistence ? The storage of an object on a disk or other permanent storage device or data that exists from session to session as opposed to transient data Persistent data typically implies that it is durable (i.e. will survive a crash or shutdown of the process) usually with some guarantee of integrity Persistence generally implies use of a database One could use the file system (with suitably careful procedures)
  • 4. Persistence Class Default constructor Get/set pairs Collection property is an interface type Identifier property public class AuctionItem { private Long _id; private Set _bids; private Bid _successfulBid private String _description; public Long getId() { return _id; } private void setId(Long id) { _id = id; } public String getDescription() { return _description; } public void setDescription(String desc) { _description=desc; } … }
  • 5. O/R Mapping Object-Relational mapping (aka O/RM , ORM , and O/R mapping ), is a programming technique for converting data between incompatible type systems in databases and Object-oriented programming languages. In effect, this creates a "virtual object database " which can be used from within the programming language. There are both free and commercial packages available that perform object-relational mapping, although some programmers opt to create their own ORM tools.
  • 6. O/R Mapping Most business database applications use relational databases Need to map the objects in the application to tables in the database Sometimes be a simple matter of mapping individual classes to separate database tables However, if the class structure is more complex, then the mapping must be carefully considered to allow data to be represented and accessed as efficiently as possible
  • 8. O/R Mapping . JavaObject int id; String name; String getName() int getId() void setName(String) void setId(int) SQL Table id [number] primary key, name [varchar(50)] Magic Happens Here (O/R Mapper – i.e. Hibernate)
  • 9. Who, What, When Officially maintained by Jboss, Inc, started in December, 2001. Hibernate is an object-relational mapping (ORM) solution for the Java language. It is free, open source software that is distributed under the GNU Lesser General Public License. It provides an easy to use framework for mapping an object-oriented domain model to a traditional relational database.
  • 10. History is Awesome! Hibernate was developed by a team of Java software developers around the world led by Gavin King. JBoss Group (now part of Red Hat) later hired the lead Hibernate developers and worked with them in supporting Hibernate. This move brought Hibernate development under Java EE Specifications. The current version of Hibernate is Version 3.1, which enriched the platform with new features like a new Interceptor/Callback architecture, user defined filters, and JDK 5.0 Annotations (Java's metadata feature). Hibernate 3 is also very close to the EJB 3.0 specification (although it was finished before the EJB 3.0 specification was released by the Java Community Process) and serves as the backbone for the EJB 3.0 implementation of JBoss.
  • 11. Architecture Hibernate basically sits between the DB and your code Can map persistent objects to tables
  • 12. Why Hibernate ? The purpose of Hibernate is to relieve the developer from a significant amount of common data persistence-related programming tasks. Hibernate adapts to the developer's development process, whether starting from scratch or from a legacy database. Minimize database access with smart fetching strategies Opportunities for aggressive caching Structural mapping more robust when object/data model changes
  • 13. Why Hibernate ? Minimizes Code Does not require a container Model is not tied to persistence implementation
  • 14. Features Hibernate not only takes care of the mapping from Java classes to database tables (and from Java data types to SQL data types), but also provides data query and retrieval facilities and can significantly reduce development time otherwise spent with manual data handling in SQL and JDBC. Hibernate generates the SQL calls and relieves the developer from manual result set handling and object conversion, keeping the application portable to all SQL databases.
  • 15. Features HibernateDaoSupport – superclass, easy HibernateTemplate access Database independence - sits between the database and your java code, easy database switch without changing any code Object / Relational Mapping (ORM) - Allows a developer to treat a database like a collection of Java objects Object oriented query language (HQL) - *Portable* query language, supports polymorphic queries etc. You can also still issue native SQL, and also queries by “Criteria” (specified using “parse tree” of Java objects) Hibernate Mapping - Uses HBM XML files to map value objects (POJOs) to database tables Transparent persistence - Allows easy saves/delete/retrieve for simple value objects Very high performance “in general” due to intelligent (2-level) caching, although in a few cases hand-written SQL might beat it
  • 16. Hibernate's Goal Remove 95% of common data persistence problems
  • 17. Advantages Support for Query Language Database Dependent Code Maintenance Cost Optimize Performance Automatic Versioning and Time Stamping Open-Source, Zero-Cost Product License Scalable
  • 18. Disadvantages Steep Learning Curve Use of Hibernate is an overhead for the applications which are : • simple and use one database that never change • need to put data to database tables, no further SQL queries • there are no objects which are mapped to two different tables Hibernate increases extra layers and complexity. So for these types of applications JDBC is the best choice.
  • 19. Disadvantages Support for Hibernate on Internet is not sufficient. Hibernate does not allow some type of queries which are supported by JDBC. For example It does not allow to insert multiple objects (persistent data) to same table using single query. Developer has to write separate query to insert each object.