JPA and Hibernate

Course Code: HIBI

Duration: 3 days

 
 
 
 

JPA and Hibernate Course Overview

Hibernate is the primary JPA implementation and the most popular Java ORM framework. It dramatically reduces boilerplate code, eliminates vendor specific SQL, and eases the reading and writing of composite objects and specialisations to the database.

This JPA and Hibernate course delivered using JPA v3 and Hibernate v6, focuses on the practical aspects of using the framework as part of the technology stack. Attendees will learn how to persist the instances of classes that follow natural object-oriented idioms including composition and inheritance.

Exercises and examples are used throughout the course to give practical hands-on experience with the techniques covered.

Course Objectives

This course aims to provide the delegate with the knowledge to be able to develop (or contribute to the development of) enterprise-level Java applications that use JPA and Hibernate to read from and write to relational databases.

Who will the Course Benefit?

The JPA and Hibernate course is aimed at developers involved in the building of complex enterprise-level Java applications.

Skills Gained

The delegate will learn and acquire skills as follows:

  • Install and configure Hibernate
  • Map basic classes to database tables
  • Describe the Hibernate Session and the associated entity states
  • Perform basic CRUD operations
  • Map composite classes avoiding the n+1 problem
  • Map inheritance hierarchies efficiently
  • Code a range of HQL queries
  • Use JPA's EntityManager instead of the Hibernate Session
  • Tune the performance of a Hibernate app

JPA and Hibernate Training Course

Course Introduction

  • Administration and Course Materials
  • Course Structure and Agenda
  • Delegate and Trainer Introductions

Session 1: INTRODUCTION TO HIBERNATE

  • The problems with JDBC
  • About ORM
  • The relationship between JPA and Hibernate
  • Hibernate architecture
  • Installing Hibernate
  • Configuring the SessionFactory (XML and Java)
  • Obtaining and using a Session (basic)

Session 2: BASIC ENTITY MAPPING

  • About entity mapping
  • XML mapping
  • Annotation mapping
  • Entity types
  • Value types
  • Embeddable types
  • Collections
  • Key generation

Session 3: THE HIBERNATE SESSION

  • About the Hibernate Session
  • Transient, persistent, and detached entity states
  • Hibernate transactions
  • Using the Session to perform basic CRUD operations

JPA and Hibernate Training Course

Session 4: COMPOSITE MAPPING

  • About composite mapping
  • One-to-one
  • One-to-many
  • Many-to-many
  • Uni vs bi-directional associations
  • Cascading
  • Eager vs lazy fetching
  • The n+1 problem

Session 5: INHERITANCE MAPPING

  • About inheritance mapping
  • Mapped superclass
  • Single table
  • Joined table
  • Table per class
  • Polymorphic queries

JPA and Hibernate Training Course

Session 6: HIBERNATE QUERY LANGAUGE (HQL)

  • About Hibernate Query Language (HQL)
  • Basic queries
  • Querying for a subset of the class's fields
  • Literal, ordinal, and named parameters
  • Single result queries
  • Functions
  • Queries with joins
  • Eager fetching
  • Ordering
  • Grouping
  • Native queries
  • Named queries
  • An introduction to criteria queries

Session 7: THE JPA ENTITYMANAGER

  • About the JPA EntityManager
  • Configuring the EntityManagerFactory (XML and Java)
  • Obtaining and using an EntityManager (basic)
  • About the Persistence Context
  • About the JPA Query Language (JPQL)
  • JPA EntityManager vs Hibernate Session

Session 8: PERFORMANCE TUNING

  • Discovering performance issues
  • Choosing the right fetch type
  • Query-specific fetching
  • Using Sets, not Lists, for many-to-many associations
  • Having the database do the heavy lifting
  • First and second-level cache
  • Performing bulk updates
Notes:
  • Course technical content is subject to change without notice.
  • Course content is structured as sessions, this does not strictly map to course timings. Concepts, content and practicals often span sessions.

Requirements

Delegates attending this course should be competent Java developers who have a good understanding of OO principles and are able to build simple applications that exploit APIs including Collections, IO, and JDBC in particular. This knowledge can be obtained by attendance on the pre-requisite Java Programming 1 / Java Developer course.

Pre-Requisite Courses

Course Reviews

Adam - Government

Great Instructor! Well spoken and easy to understand.

Iqbal - Java Developer

Public Scheduled Events

Classroom & Live Virtual Instructor-Led Training

Duration: 3 days

Price: £1,650.00 exc. VAT 


Start Date Options Spaces  
22 Jan 2025
StayAhead Virtual Courses available 
Spaces Book Now 
26 Mar 2025
StayAhead Virtual Courses available 
Spaces Book Now 
28 May 2025
StayAhead Virtual Courses available 
Spaces Book Now 
30 Jul 2025
StayAhead Virtual Courses available 
Spaces Book Now 
01 Oct 2025
StayAhead Virtual Courses available 
Spaces Book Now 
01 Dec 2025
StayAhead Virtual Courses available 
Spaces Book Now 
 

Live Virtual Classroom

 
Join live instructor-led classroom training from the comfort of your home or office.
All the convenience and benefits of the classroom experience without the hassle and costs of travel and accommodation.
 
 



Our Customers Include

 
EDF
Amazon
American Express
Aviva
QA
BAE
University of Cambridge
Barnardo's
Scottish Government
Bauer
Bloomberg
BP
HSBC
DVLA
GlaxoSmithKline
Government Campus
Capita
Tui
NHS
Ordnance Survey
Ministry of Defence
Zurich Insurance Group
trainline
Vodafone
 
 



Our Course Curriculum

 
 
 
+44 (0)20 7600 6116
Enquiries@StayAhead.com
Copyright © 2024 StayAhead Training Ltd
Cookies   /   Privacy Policy