Hibernate & JPA Tutorial:
Flexible Persistence for Java EE Applications
Interested in training from the author of these tutorials?
See the upcoming Spring & Hibernate/JPA
courses in Maryland , or contact hall@coreservlets.com for info
on customized courses at your location.
This tutorial was written by Matt Cherry
and is derived from
the world-renowned coreservlets.com Java EE training courses .
It is intended as a fast introduction to Hibernate and JPA for people that are already familiar
with Java programming. For learning basic Java, please see
these tutorials .
The Hibernate and JPA training course
on which this tutorial is based is usually taught on-site at customer locations, but
various Java EE training courses
at public venues are periodically scheduled for people with too few developers for an onsite course. For descriptions of
the various other courses that are available, please see
the J2EE training course page . To inquire about a customized training course
at your location, please contact Marty at
hall@coreservlets.com .
If you find these free tutorials helpful, we would appreciate it if you would
link to us .
Source Code
Source code for all examples in this tutorial can be downloaded from the
Hibernate sample code repository .
PowerPoint Files for University Faculty
The PDF files in this tutorial contain the complete text of the original
PowerPoint files, so if your goal is learning Hibernate, just stick
with this tutorial. However, as a service to instructors teaching
full-semester courses at accredited universities, coreservlets.com
will release the original PowerPoint files for free. Please
see the instructor materials page
for details.
Tutorial section:
Topics:
Refresher in enterprise application architectures
Traditional persistence
Hibernate motivation
Installation
Source code:
Tutorial section:
Topics:
Defining the domain model
Setting up the Hibernate configuration file
Creating the domain object mapping files
Making Hibernate aware of the mapping files
Updating the hibernate.cfg.xml with list of mapping files
Implementing a HibernateUtil class
Writing the code
Source code:
Tutorial section:
Topics:
Understand Collection and Association relationships
See how to realize relationships in Java and databases
Walk through the Hibernate approach of mapping both Collections and Associations
Source code:
Tutorial section:
Topics:
The difference between Components and Entities
Some uses of Components, and their mapping
Strategies and implementations for realizing inheritance
Source code:
Tutorial section:
Topics:
Entity lifecyle
The lifecycle of Hibernate entities, when they transition from state–to–state,
and how this affects development
Persistence details
A closer look at persistence
How Hibernate manages dirty and related objects
Hibernate sessions
How Hibernate uses a Session to track and optimize user activities
Source code:
Tutorial section:
Topics:
Transactions
Brush up on transactions, and recognize they're not just for databases
Explore the different ways to include transactions into applications
Protecting user data
Learn a technique for ensuring that persistent changes to objects
don't inadvertently overwrite other user's actions
Source code:
Tutorial section:
Topics:
Briefly review SQL querying
Discover Hibernate’s different approaches to querying a database
Get acquainted with the ‘Query by Criteria’ technique
Introduce the ‘Query by Example’ offshoot
Source code:
Tutorial section:
Topics:
The Hibernate Query Language
Introducing the Hibernate Query Language
Leveraging HQL to write database queries
Native SQL
Understanding when to write your own SQL
Executing Native SQL with Hibernate
Source code:
Tutorial section:
Topics:
Batch Processing
Data Filtering
Interceptors and Events
Calling Triggers and Stored Procedures
2nd Level Cache
Statistics
DDL Generation
Integration with Spring
Source code:
Tutorial section:
Topics:
Become acquainted with the Java Persistence API (JPA)
Compare and contrast Hibernate and JPA
Learn how to setup and use Hibernate as a JPA provider
Source code:
Java
Java SE 7 API
Java SE 8 API
Java SE Downloads for Windows, Linux, & Solaris
Java SE Downloads for MacOS 10.6
Java EE 6 API.
Includes the servlet 3.0, JSP 2.2, and JSF 2.0 APIs.
Java EE 6 Technologies.
Includes servlet 3.0, JSP 2.2, JSTL 1.2, and JSF 2.0 specifications
Java EE 5 API.
Includes the servlet 2.5, JSP 2.1, and JSF 1.1 APIs.
Java 7 Programming Tutorial
Java 8 Tutorial: Lambdas, Streams, & More
Java 7 & 8 Training Courses
Recommended Java Programming Books
General Java Programming Resources
JSF (JavaServer Faces)
Servlets & JSP
Ajax, GWT, & JavaScript
Spring, Hibernate, & JPA
Struts