SlideShare a Scribd company logo
1 of 26
Download to read offline
Hibernate ORM
& JPA Overview
Brett Meyer
Senior Software Engineer
Hibernate ORM, Red Hat
Brett Meyer
• JBoss Overlord (SOA Governance)
• Hibernate ORM
– ORM 4 & 5 development
– Hibernate OSGi
– Developer community engagement
– Red Hat support, Hibernate engineering lead
• Other contributions
– Apache Camel
– Infinispan
• Contact me
– @brettemeyer or +brettmeyer
– Freenode IRC: brmeyer
github.com/brmeyer
/HibernateDemos
slideshare.net/brmeyer
ORM? JPA?
• ORM: Object/Relational Mapping
• JPA: Java Persistence API
• Hibernate ORM provides its own native
API, in addition to full JPA support
• Annotations and XML
Overview
• JDBC
• Why ORM?
• Why JPA?
• Hibernate ORM
• Demos
JDBC
JDBC
• “Java Database Connectivity”
• Java SE library for querying/updating database
data
• Mainly focused on relational DBs
• Manages Connections to the DB, either directly
or through a 3rd
party “Connection Pool”
• Database vendors provide their own JDBC
driver libraries
JDBC (cont'd)
• API abstracts common interactions,
data types, etc.
• Execute SQL through “Statements”
• Query returns received through
“ResultSets”
• Transactional
• Cacheable
JDBC Demo
Why ORM?
ORM
• “Object/Relational Mapping”
• “Persistence”: Data objects outlive the
JVM app
• Maps Java POJOs to relational
databases (one type of “persistence”)
Why ORM?
• “Domain Model” pattern
– Focus on business concepts, not relational DB
structure
– Interconnected objects
– Each object is a meaningful individual/concept
– OO concepts: inheritance, object identity, etc.
– Navigate data by walking the object graph, not the
explicit relational model
Why ORM? (cont'd)
• Increased development speed &
reduced code
– No “by-hand” mapping of JDBC ResultSets
to POJOs
– Less work synchronizing code with
relational DB changes
– Less JBDC boilerplate (repetitious CRUD)
– Focus on business logic
Why ORM? (cont'd)
• Portability
– Mostly DB independent (exception: some
types of features, identifier generation,
etc.)
– Query abstractions (OO APIs, OO-
structured languages, etc.)
– Vendor-specific SQL is auto generated
Why ORM? (cont'd)
• Performance
– Granular control of “when”, “how”, “how much”
data/relationships to load, based on the business logic
– Object and query caching
• Concurrency & multiple-tenancy
• Transactional
• Scalable
• Extendable (many types of extension points)
ORM FUD
• “ORMs are slow and generally awful.”
– http://www.slideshare.net/brmeyer/hibernate-orm
• “ORMs are over complicated.”
– Back in the EJB/XML days, maybe.
– Annotations FTW!
ORM Demo
Why JPA?
JPA
• “Java Persistence API”
• JSR 317 (2.0) & JSR 338 (2.1)
• Included in both Java SE & Java EE
• Provides portability between JPA
implementations (with caveats)
• Same ORM concepts, but standardized
API and query language (JPQL)
JPA Demo
Hibernate ORM
Hibernate ORM
• JPA implementation and 100% TCK compliant
• “Native” features
– HQL (Hibernate Query Language): similar to JPQL, but
extended
– Criteria API
– Performance: Fetch strategies, caching, bytecode
enhancement, etc.
– Extension points
– Rich tool set (schema generation/validation, etc.)
• Part of JBoss Community
Hibernate Family
• Not just ORM
• Hibernate Spatial
• Hibernate Envers
• Hibernate OSGi
• Hibernate Search
• Hibernate OGM
• Hibernate Validator
• Hibernate Shards
• http://www.slideshare.net/brmeyer/hibernate-orm-features
We've barely
scratched the
surface!
How to Help:
hibernate.org
/orm/contribute
QUESTIONS?
• Q&A
• Freenode IRC: brmeyer
• @brettemeyer
• +brettmeyer

More Related Content

Similar to hibernateormoverview-140501154227-phpapp02.pdf

Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3
Wen-Tien Chang
 
SeaJUG May 2012 mybatis
SeaJUG May 2012 mybatisSeaJUG May 2012 mybatis
SeaJUG May 2012 mybatis
Will Iverson
 
MongoDC 2012: "Operationalizing" MongoDB@AOL
MongoDC 2012: "Operationalizing" MongoDB@AOLMongoDC 2012: "Operationalizing" MongoDB@AOL
MongoDC 2012: "Operationalizing" MongoDB@AOL
MongoDB
 
2013 CPM Conference, Nov 6th, NoSQL Capacity Planning
2013 CPM Conference, Nov 6th, NoSQL Capacity Planning2013 CPM Conference, Nov 6th, NoSQL Capacity Planning
2013 CPM Conference, Nov 6th, NoSQL Capacity Planning
asya999
 

Similar to hibernateormoverview-140501154227-phpapp02.pdf (20)

Hibernate
HibernateHibernate
Hibernate
 
Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3
 
Why we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL DatabaseWhy we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL Database
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability Patterns
 
JSR 335 / java 8 - update reference
JSR 335 / java 8 - update referenceJSR 335 / java 8 - update reference
JSR 335 / java 8 - update reference
 
SeaJUG May 2012 mybatis
SeaJUG May 2012 mybatisSeaJUG May 2012 mybatis
SeaJUG May 2012 mybatis
 
What is persistence in java
What is persistence in javaWhat is persistence in java
What is persistence in java
 
MongoDC 2012: "Operationalizing" MongoDB@AOL
MongoDC 2012: "Operationalizing" MongoDB@AOLMongoDC 2012: "Operationalizing" MongoDB@AOL
MongoDC 2012: "Operationalizing" MongoDB@AOL
 
Operationalizing MongoDB at AOL
Operationalizing MongoDB at AOLOperationalizing MongoDB at AOL
Operationalizing MongoDB at AOL
 
New Persistence Features in Spring Roo 1.1
New Persistence Features in Spring Roo 1.1New Persistence Features in Spring Roo 1.1
New Persistence Features in Spring Roo 1.1
 
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
1. SQL Server forSharePoint geeksA gentle introductionThomas Vochten • Septem...
 
CQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java DevelopersCQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java Developers
 
Why databases cry at night
Why databases cry at nightWhy databases cry at night
Why databases cry at night
 
Scaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQLScaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQL
 
Store
StoreStore
Store
 
Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...
Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...
Introducing NoSQL and MongoDB to complement Relational Databases (AMIS SIG 14...
 
Performance and Abstractions
Performance and AbstractionsPerformance and Abstractions
Performance and Abstractions
 
Clojure - Why does it matter?
Clojure - Why does it matter?Clojure - Why does it matter?
Clojure - Why does it matter?
 
Advance Database Management Systems -Object Oriented Principles In Database
Advance Database Management Systems -Object Oriented Principles In DatabaseAdvance Database Management Systems -Object Oriented Principles In Database
Advance Database Management Systems -Object Oriented Principles In Database
 
2013 CPM Conference, Nov 6th, NoSQL Capacity Planning
2013 CPM Conference, Nov 6th, NoSQL Capacity Planning2013 CPM Conference, Nov 6th, NoSQL Capacity Planning
2013 CPM Conference, Nov 6th, NoSQL Capacity Planning
 

More from Patiento Del Mar

Managed Extenibility Framework in C# - MEF
Managed Extenibility Framework  in C#  - MEFManaged Extenibility Framework  in C#  - MEF
Managed Extenibility Framework in C# - MEF
Patiento Del Mar
 
13-Concurrence-Producteur-consommateur.pdf
13-Concurrence-Producteur-consommateur.pdf13-Concurrence-Producteur-consommateur.pdf
13-Concurrence-Producteur-consommateur.pdf
Patiento Del Mar
 
15-Concurrence-Operations-Atomiques.pdf
15-Concurrence-Operations-Atomiques.pdf15-Concurrence-Operations-Atomiques.pdf
15-Concurrence-Operations-Atomiques.pdf
Patiento Del Mar
 

More from Patiento Del Mar (20)

Managed Extenibility Framework in C# - MEF
Managed Extenibility Framework  in C#  - MEFManaged Extenibility Framework  in C#  - MEF
Managed Extenibility Framework in C# - MEF
 
grpc_tutorial.pdf
grpc_tutorial.pdfgrpc_tutorial.pdf
grpc_tutorial.pdf
 
0.coursGitEclipse.pdf
0.coursGitEclipse.pdf0.coursGitEclipse.pdf
0.coursGitEclipse.pdf
 
Primefaces.ppt
Primefaces.pptPrimefaces.ppt
Primefaces.ppt
 
Spring Data Advanced Querying.ppt
Spring Data Advanced Querying.pptSpring Data Advanced Querying.ppt
Spring Data Advanced Querying.ppt
 
Thymeleaf and Spring Controllers.ppt
Thymeleaf and Spring Controllers.pptThymeleaf and Spring Controllers.ppt
Thymeleaf and Spring Controllers.ppt
 
Spring Security.ppt
Spring Security.pptSpring Security.ppt
Spring Security.ppt
 
momjms.pdf
momjms.pdfmomjms.pdf
momjms.pdf
 
rmi.pdf
rmi.pdfrmi.pdf
rmi.pdf
 
synchronization.pdf
synchronization.pdfsynchronization.pdf
synchronization.pdf
 
cours6.pdf
cours6.pdfcours6.pdf
cours6.pdf
 
java_PAR.pdf
java_PAR.pdfjava_PAR.pdf
java_PAR.pdf
 
11-Concurrence-Section critiques.pdf
11-Concurrence-Section critiques.pdf11-Concurrence-Section critiques.pdf
11-Concurrence-Section critiques.pdf
 
22-reflection.pdf
22-reflection.pdf22-reflection.pdf
22-reflection.pdf
 
16-Concurrence-APIs-Concurrentes.pdf
16-Concurrence-APIs-Concurrentes.pdf16-Concurrence-APIs-Concurrentes.pdf
16-Concurrence-APIs-Concurrentes.pdf
 
12-Concurrence-Rendez-vous.pdf
12-Concurrence-Rendez-vous.pdf12-Concurrence-Rendez-vous.pdf
12-Concurrence-Rendez-vous.pdf
 
17-Concurrence-Fork-Join.pdf
17-Concurrence-Fork-Join.pdf17-Concurrence-Fork-Join.pdf
17-Concurrence-Fork-Join.pdf
 
13-Concurrence-Producteur-consommateur.pdf
13-Concurrence-Producteur-consommateur.pdf13-Concurrence-Producteur-consommateur.pdf
13-Concurrence-Producteur-consommateur.pdf
 
15-Concurrence-Operations-Atomiques.pdf
15-Concurrence-Operations-Atomiques.pdf15-Concurrence-Operations-Atomiques.pdf
15-Concurrence-Operations-Atomiques.pdf
 
Concurrence-Interruption-Exceptions.pdf
Concurrence-Interruption-Exceptions.pdfConcurrence-Interruption-Exceptions.pdf
Concurrence-Interruption-Exceptions.pdf
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

hibernateormoverview-140501154227-phpapp02.pdf

  • 1. Hibernate ORM & JPA Overview Brett Meyer Senior Software Engineer Hibernate ORM, Red Hat
  • 2. Brett Meyer • JBoss Overlord (SOA Governance) • Hibernate ORM – ORM 4 & 5 development – Hibernate OSGi – Developer community engagement – Red Hat support, Hibernate engineering lead • Other contributions – Apache Camel – Infinispan • Contact me – @brettemeyer or +brettmeyer – Freenode IRC: brmeyer
  • 4. ORM? JPA? • ORM: Object/Relational Mapping • JPA: Java Persistence API • Hibernate ORM provides its own native API, in addition to full JPA support • Annotations and XML
  • 5. Overview • JDBC • Why ORM? • Why JPA? • Hibernate ORM • Demos
  • 7. JDBC • “Java Database Connectivity” • Java SE library for querying/updating database data • Mainly focused on relational DBs • Manages Connections to the DB, either directly or through a 3rd party “Connection Pool” • Database vendors provide their own JDBC driver libraries
  • 8. JDBC (cont'd) • API abstracts common interactions, data types, etc. • Execute SQL through “Statements” • Query returns received through “ResultSets” • Transactional • Cacheable
  • 11. ORM • “Object/Relational Mapping” • “Persistence”: Data objects outlive the JVM app • Maps Java POJOs to relational databases (one type of “persistence”)
  • 12. Why ORM? • “Domain Model” pattern – Focus on business concepts, not relational DB structure – Interconnected objects – Each object is a meaningful individual/concept – OO concepts: inheritance, object identity, etc. – Navigate data by walking the object graph, not the explicit relational model
  • 13. Why ORM? (cont'd) • Increased development speed & reduced code – No “by-hand” mapping of JDBC ResultSets to POJOs – Less work synchronizing code with relational DB changes – Less JBDC boilerplate (repetitious CRUD) – Focus on business logic
  • 14. Why ORM? (cont'd) • Portability – Mostly DB independent (exception: some types of features, identifier generation, etc.) – Query abstractions (OO APIs, OO- structured languages, etc.) – Vendor-specific SQL is auto generated
  • 15. Why ORM? (cont'd) • Performance – Granular control of “when”, “how”, “how much” data/relationships to load, based on the business logic – Object and query caching • Concurrency & multiple-tenancy • Transactional • Scalable • Extendable (many types of extension points)
  • 16. ORM FUD • “ORMs are slow and generally awful.” – http://www.slideshare.net/brmeyer/hibernate-orm • “ORMs are over complicated.” – Back in the EJB/XML days, maybe. – Annotations FTW!
  • 19. JPA • “Java Persistence API” • JSR 317 (2.0) & JSR 338 (2.1) • Included in both Java SE & Java EE • Provides portability between JPA implementations (with caveats) • Same ORM concepts, but standardized API and query language (JPQL)
  • 22. Hibernate ORM • JPA implementation and 100% TCK compliant • “Native” features – HQL (Hibernate Query Language): similar to JPQL, but extended – Criteria API – Performance: Fetch strategies, caching, bytecode enhancement, etc. – Extension points – Rich tool set (schema generation/validation, etc.) • Part of JBoss Community
  • 23. Hibernate Family • Not just ORM • Hibernate Spatial • Hibernate Envers • Hibernate OSGi • Hibernate Search • Hibernate OGM • Hibernate Validator • Hibernate Shards • http://www.slideshare.net/brmeyer/hibernate-orm-features
  • 26. QUESTIONS? • Q&A • Freenode IRC: brmeyer • @brettemeyer • +brettmeyer