Java Persistence with Hibernate

Request info

Course duration: 2 Days

Overview

This course develops skills in using the Object/Relational Mapping tool Hibernate. The course uses the latest release version of Hibernate, 3.2, which is directly related to the new EJB 3.0 version defined in Java EE 5.0. By the end of the course, students will be prepared to set-up and use Hibernate as the persistence mechanism in Java applications.

Layout

The training course combines lectures with practical exercises that help the delegates to put what they have learned on the training course into practice. The exercises specifically build on what has been recently taught and are built up as the training course progresses.

Who it is for

Java Programmers

Training Course Prerequisites

Intermediate knowledge of Java programming and JDBC
Experience with SQL and relational databases

Training Course Objectives

At the end of this training course, students should be able to:

Introduction to Hibernate
Configuring Hibernate
Hibernate Persistence
Object/Relational Mapping
The Criteria Query API
The Hibernate Query Language

Training Course Contents

1. Introduction to Hibernate

Introducing Hibernate
The Object/Relational Mapping Problem
The Impedance Mismatch
JDBC
The Users-Roles Schema
Tools and Environment Setup
Creating the Database
The Role Class
The Hibernate Alternative
XML Tools

2. Configuring Hibernate

Hibernate Distributions
Required Libraries
Configuration Files
hibernate.properties
hibernate.cfg.xml
XML Configuration Model
Programmatic Configuration

3. Hibernate Persistence

The Hibernate Architecture
Interface Model
SessionFactory Methods
Hibernate Sessions
Object States
State Transitions
Session Methods
Transactions
Session-Per-Operation
Session-Per-Request
The Data Access Object Pattern

4. Object/Relational Mapping

Object-Oriented Design
Relational Mapping
Bidirectional Association
O/R Mapping Techniques
The Mapping Document
The Mapping XML Model
Primary Keys and Identity
Generating Identifiers
Other Mapping Elements
Earthlings Schema
Earthlings Relationships
Earthlings UML
Components
Mapping Associations
The Mapping XML Model for Associations
Unidirectional Many-to-One
Eager Fetching
Bidirectional One-To-Many
Bidirectional One-To-One
Mapping Inheritance
Inheritance and Databases
Single-Table Inheritance
Mapping Single-Table Inheritance
Table-Per-Subclass
Table-Per-Subclass Mapping
Table-Per-Concrete-Class

5. The Criteria Query API

Criteria Queries
The Criteria Interface
The Criteria API
The Restriction Class Utility
Other Restrictions
Windowing Results
Sorting Query Results
Projections and Aggregates
The Projections Class Utility
The ProjectionList Class
Query By Example

6. The Hibernate Query Language

The Hibernate Query Language
Fundamentals
HQL Queries
Polymorphism
Named Parameters
Entity Parameters
Joining on Associations
Aggregate Methods
Updates and Deletes
Named Queries
Using Native SQL

SELECT wp_posts.*, wp_p2p.* FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) INNER JOIN wp_p2p WHERE 1=1 AND ( ( wp_postmeta.meta_key = 'start_date' AND CAST(wp_postmeta.meta_value AS DATE) >= '2025-03-18' ) ) AND ((wp_posts.post_type = 'schedule' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))) AND (wp_p2p.p2p_type = 'schedule_to_courses' AND wp_posts.ID = wp_p2p.p2p_from AND wp_p2p.p2p_to IN (SELECT wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.ID IN (939) AND ((wp_posts.post_type = 'courses' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled'))) ORDER BY wp_posts.post_date DESC )) GROUP BY wp_posts.ID ORDER BY CAST(wp_postmeta.meta_value AS DATE) ASC