Mastering Hibernate 5 for Persistence in Java

Working with Hibernate | ORM, JPA, Associations, Mapping Inheritance, Persistent Objects & More

TT3205

Intermediate

3 Days

Course Overview

Mastering Hibernate 5 for Persistence in Java is a lab-intensive, hands-on course geared for experienced Java developers who need to understand what Hibernate is in terms of today's systems and architectures, and how to apply Hibernate to persistence requirements in Java and JEE applications. 

 

Hibernate is a powerful enabler that addresses object/relational persistence in the Java world. Hibernate offers all the advantages of developing in Java plus a comprehensive suite of capabilities for mapping object-oriented features to the relational model.  This course explores how to design and build your own Hibernate-enabled applications, leveraging key Hibernate capabilities and strengths, with a special focus on using Hibernate with other technologies and frameworks.  At the same time, you'll be learning about the big picture of Hibernate and how to design applications to use Hibernate in a robust, efficient, secure, and maintainable fashion. If you want to deliver an application using Hibernate, you'll find this course essential.

Course Objectives

Students who attend Mastering Hibernate will leave the course armed with the required skills to design and implement Java applications that effectively and transparently use Hibernate to manage data persistence.  This course provides coverage of Hibernate concepts and practices for interacting between Java and relational databases.  The areas addressed in this course range from data/class mapping and persisted object lifecycle and management to how to query for persistent objects.

 

Experiential, Hands-On Learning: This “skills-centric” course is about 50% hands-on lab and 50% lecture, designed to train attendees in core Hibernate development skills, coupling the most current, effective techniques with the soundest industry practices. Throughout the course students will be led through a series of progressively advanced topics, where each topic consists of lecture, group discussion, comprehensive hands-on lab exercises and review.

 

Working in an engaging hands-on programming environment, students will learn to:

  • Explain how the issues associated with object persistence in a relational model are addressed by Hibernate
  • Understand the relationships between SQL, Java, JDBC, Spring, Java Persistence API, EJB 3.0, and Hibernate
  • Write applications that take advantage of the Hibernate Persistence Manager.
  • Map Java classes to relational tables.
  • Capture both relational and inheritance associations in metadata using either XML or the Java Annotation mechanism.
  • Create and use mappings between Java classes and relational databases.
  • Understand how identity and keys are handled in Hibernate.
  • Understand the persistent object lifecycle and how that relates to transactions and concurrency.
  • Become familiar with the mapping of entity associations to database tables
  • Query for data using the Java Persistence Query Language (JPQL) and the Criteria API

Course Prerequisites

This an intermediate- level training course, designed for experienced Java developers. 

Course Agenda

Session: Introduction to Hibernate 5

 

Lesson: Introduction to Hibernate

·        Introducing Hibernate

·        Understand the goals of ORM frameworks

·        Define Object to Relational (O/R) Mapping

·        Explain the requirements of JPA Entities

·        Defining persistent properties

  • Tutorial: Setup Eclipse for Using Maven

 

Lesson: Getting Started with Hibernate

·        The nuts and bolts of Hibernate

·        Setup Hibernate (modules and artifacts)

·        Configure Hibernate

·        DDL management

·        SessionFactory and Session

·        Bootstrapping Hibernate

·        Mapping a simple entity

·        Explain the entity life-cycle

·        Methods to control the life-cycle

·        Tutorial: Using the Eclipse SQL Database Development Perspective

·        Exercise: Getting Started with Hibernate

 

Session: ORM with Hibernate

 

Lesson: Basic ORM

·        Configure persistent classes

·        Hibernate Types

·        Object identity

·        Generating the primary key

·        Declaring persistence

·        Mapping enumerations

·        Converting attributes to database types

·        Exercise: Basic ORM

 

Lesson: Additional ORM mapping

·        Define compound Primary Keys

·        Understand Hibernate’s basic type mapping

·        Customize type mapping

·        Map single entity to multiple tables

·        Exercise:  Advanced ORM

 

Lesson: Value-Type Collections and Components

·        Mapping Aggregates (One-to-One)

·        @Embeddable

·        Collection mapping

·        Mapping Aggregates (One-to-Many)

·        Exercise: Embeddables

 

Session: The Java Persistence API (JPA)

 

Lesson: Java Persistence API (JPA) and Hibernate

·        The relationship between JPA and Hibernate

·        The persistence.xml

·        Configuring the persistence framework

·        Introduce transaction Management

·        The EntityManager

·        Differences between SessionFactory and EntityManager

·        Exercise: Setup JPA

 

Lesson: JPA Callbacks

·        JPA Callback annotations and methods

·        Entity life-cycle notifications

·        Exercise: Adding JPA Callbacks

 

Session: Associations and Inheritance

 

Lesson: Introduction to Entity Associations (Relations)

·        Different types of associations

·        uni- and bidirectional associations

·        The owning-side of the relationship

·        Map one-to-one relations

·        Exercise: OneToOne associations

 

Lesson: Entity Associations (Relations)

·        Mapping One-to-Many/Many-to-One Associations

·        Introduce different mapping strategies

·        Cascading operations

·        Mapping Many-to-Many associations

·        Exercise: Mapping One To Many Relationships

 

Lesson: Mapping Inheritance

·        Inheritance ORM strategies

·        @DiscriminatorValue and @DiscriminatorFormula

·        Exercise: Mapping Inheritance

 

Session: Using Persistent Objects

 

Lesson: JPQL

·        Use JPQL to select data

·        Query and TypedQuery

·        Obtaining query results

·        Query parameter binding

·        Named queries

·        Different clauses of JPQL query

·        Use JPQL to Update or Delete

·        Exercise: Using JPQL

 

Lesson: Criteria API

·        Introduce the Criteria API

·        Explain the need for an additional API for creating statements

·        The Criteria Meta Model

·        Selecting data using the Criteria API

·        Use the Criteria API for batch updates and deletes

·        Exercise: Using the Criteria API

·        Tutorial: Configuring The JPA Annotation Processor

 

Lesson: Query By Example (Optional – Upon Request)

§  Explain Query By Example

§  Use QBE to search for data

·        Exercise: Query By Example

 

Course Materials

Each student will receive a Student Guide with detailed course notes, code samples, software tutorials, diagrams and related reference materials and links (as applicable). Our courses also include a Student Workbook, with step by step hands-on lab instructions and and solutions, clearly illustrated for users to complete hands-on work in class, and to revisit to review or refresh skills at any time. Students will also receive the course environment software and set up files, project files (or code, if applicable) and solutions required for the hands-on work.

Raise the bar for advancing technology skills

Attend a Class!

Live scheduled classes are listed below or browse our full course catalog anytime

Special Offers

We regulary offer discounts for individuals, groups and corporate teams. Contact us

Custom Team Training

Check out custom training solutions planned around your unique needs and skills.

EveryCourse Extras

Exclusive materials, ongoing support and a free live course refresh with every class.

Learning is Twice as Nice!
Buy One Get One Free!

Enroll by February 28 in any TWO public classes in 2023 for the price of ONE! 

Click for Details & Additional Offers

Learn. Explore. Advance!

Extend your training investment! Recorded sessions, free re-sits and after course support included with Every Course
Trivera MiniCamps
Gain the skills you need with less time in the classroom with our short course, live-online hands-on events
Trivera QuickSkills: Free Courses and Webinars
Training on us! Keep your skills current with free live events, courses & webinars
Trivera AfterCourse: Coaching and Support
Expert level after-training support to help organizations put new training skills into practice on the job

The voices of our customers speak volumes

Special Offers
Limited Offer for most courses.

SAVE 50%

Learn More