How To Take This Class

Course Overview

Integrating Hibernate and Spring2.5 (Hibernate Emphasis) is a five day in-depth 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 J2EE applications. The course then covers to the Spring framework and how to integrate Hibernate as the persistence layer for Spring applications.

Course Prerequisites

Attendees should have practical basic Java development experience.

Course Audience

This an intermediate level and beyond Java training course, designed for developers who need to understand how and when to use Hibernate in Spring applications.

What You'll Learn

Upon successful completion of this course, students will be able to:
  • Explain how the issues associated with object persistence in a relational model are addressed by Hibernate
  • Understand the relationships between SQL, Java, Spring, and Hibernate
  • Discuss the challenges to adopting Hibernate in the enterprise
  • 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 5 Annotations 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
  • Take advantage of Hibernate's data filtering and interception
  • Explain the issues associated with complex frameworks such as J2EE and how Spring addresses those issues
  • Write applications that take advantage of the Spring container and the declarative nature of assembling simple components into applications
  • Work with Spring's support for transactions
  • Understand how to use Hibernate within the Spring framework

Course Duration

5 Days

Course Outline

  1. Introduction to Hibernate
    • ORM Mapping Issues
    • Hibernate Architecture
    • Persistence, Identity, and Equality in Hibernate
    • Domain Models and Metadata Options
    • Options for Representing Persistence
  2. Getting Started with Hibernate
    • Basic Mapping
    • Class/properties to Table/Columns
    • Basic Configuration
    • Mapping a POJO to a Database
    • Syntax of mapping file
    • Basics of Hibernate Session
    • Working with Persisted Objects
  3. Basic ORM in Hibernate
    • Configuring persistence
    • Object Identity in Hibernate
    • Generating Unique Keys
    • Mapping Classes to Multiple Tables
  4. Value-Type Collections and Components
    • Element Types
    • Mapping Compositions
    • Mapping Java Collections
    • Bags and Dynamic Components
  5. Entity Associations (Relations)
    • Types of Associations
    • Uni- and Bi-Directional Associations
    • Using Join Tables
    • Many-to-Many Associations
    • Cascading Over Associations
  6. Mapping Inheritance
    • Strategies for Inheritance ORM
    • Single, Class, and Concrete Table Patterns
    • Discriminators
  7. Hibernate Annotations
    • Working with Hibernate Annotations
    • Annotation-Capable Sessions
    • Annotations and Persistence
    • Annotations, Mapping, and Relationships
  8. Working with Persistent Objects
    • Transient, Persistent, and Detached
    • Transitioning Between States
    • Options for Retrieving Objects
    • Attached and Detached States
    • Update, Merge, and Cascade
  9. Transactions
    • Transaction Control and Isolation Levels
    • Options for Demarcating Transactions
    • Using a Contextual Session
    • Correctly Handling Exceptions
    • Optimistic and Pessimistic Locking in Hibernate
    • Lock Scopes and Cascading
  10. Querying for Objects
    • Hibernate Query API
    • Hibernate Query Language (HQL)
    • HQL Syntax and Usage
    • Criteria
  11. Introduction to the Spring 2.5 Framework
    • Understanding the value of Spring
    • Inversion of Control
    • Dependency Injection
    • Spring Overview
    • Spring Application Architectures
    • Spring Container
    • Managing the Container
    • Access to Services and Resources
    • Application Contexts
    • Beans as Components
    • Beans and Factories
    • XML Bean Configuration
    • Bean Definition and Dependencies
    • Bean Lifecycle
    • Customization Options
    • Post-Processors
    • Property Editors
  12. Data Access
    • Data Access Pattern
    • Overview of Persistence Layer and Transactions
    • Transaction Overview
    • Spring Transactions
    • Defining Spring Transactions
    • Working with Demarcation
    • Managing Spring Transactions
    • Hibernate
    • Spring - Hibernate Architecture
    • ORM Mapping Overview
    • DAO Implementation
    • Working with Hibernate DAOs in Spring
    • Hibernate Template