Great instructor! Easy to follow course documentation. More Testimonials »

JPA Training with Hibernate

Delivery Options

Class Date and Time Price Pricing Information
$1,900.00
or 4 vouchers vouchers
$1,900.00 or 4 vouchers vouchers
$1,900.00 or 4 vouchers vouchers

Class Description

Class Overview

This course offers a comprehensive and detail-oriented treatment of Hibernate® 4.0 and the Java Persistence API (JPA) 2.0 for developers interested in implementing persistence tiers for enterprise applications. We cover JPA basics including simple object/relational concepts and annotations, persistence contexts and entity managers, and configuration via persistence.xml. We get a good grounding in the Java Persistence Query Language (JPQL) and take advantage of a prepared JPQL query console to explore the two schemas on which the course's case studies are based. The course then moves into advanced topics including JPA-2.0 mapping options, the Criteria API, lifecycle hooks, JSR-303 validation, locking, and caching. Students will complete the course with a firm understanding of JPA architecture and plenty of hands-on exercise in entity mapping, persistence operations, and JPQL.

Course software includes two schemas: a fairly simple human-resources model (6 tables, 253 rows) for early chapters and a more sophisticated pharmacy schema (14 tables, 4255 rows) for the latter half of the course. The pharmacy schema is based on an open-source project and made available to Capstone Courseware by special permission.

The course supports either the Derby or Oracle RDBMS. Derby is bundled with the course software and is pre-configured; a script is included to change over to Oracle configurations for all exercises and schema-creation scripts are available for both.

Class Goals

  • Understand the value of object/relational mapping and JPA's role as a standard for ORM implementations.
  • Develop JPA entities using JPA annotations to align the Java classes, properties, and types to relational tables, columns, and types.
  • Create entity managers and instantiate persistence contexts to perform persistence operations.
  • Carry out create/retrieve/update/delete (CRUD) operations on JPA entities using entity managers.
  • Implement entity relationships of all cardinalities, including unidirectional and bidirectional relationships.
  • Implement special ORM cases such as composite primary keys, inheritance relationships, and cascading operations.
  • Use JPQL to write object-oriented queries, and process query results.
  • Use the Criteria API to define queries programmatically, and take advantage of type safety using the Metamodel API.
  • Build reusable façades that encapsulate simpler and more complex persistence operations.
  • Implement persistence lifecycle event handlers.
  • Define JSR-303 validation constraints on JPA entities and see them enforced by the JPA provider.
  • Make well-informed decisions about locking strategies, and understand the role of the JPA cache in enterprise applications.

Class Outline

  1. Introduction to JPA
    1. Object/Relational Mapping
    2. Mismatches Between Relational and Object Models
    3. The Java Persistence API
    4. Hibernate
    5. History
    6. Architecture
    7. Entity Metadata
    8. The Entity Manager
  2. Object/Relational Mapping
    1. Annotations
    2. JavaBean Standards
    3. Property, Field, and Mixed Access
    4. Table and Column Mapping
    5. Primary Keys and Generation
    6. Type Mappings
    7. Temporal and Enumerated Types
    8. Embedded Types
    9. Entity Relationships
    10. @ManyToOne Relationships
    11. @OneToOne Relationships
    12. @OneToMany Relationships
    13. @ManyToMany Relationships
    14. Eager and Lazy Loading
  3. Entity Managers
    1. Putting Entities to Work
    2. persistence.xml
    3. Entity State and Transitions
    4. Managing Transactions
    5. Persistence Operations
    6. Creating Queries
    7. Named Queries
    8. Query Parameters
    9. Native Queries
  4. JPQL
    1. The Java Persistence Query Language
    2. HQL and JPQL
    3. Query Structure
    4. Path Expressions
    5. Filtering
    6. Scalar Functions
    7. Operators and Precedence
    8. between, like, in
    9. is null, is empty
    10. Ordering
    11. Aliases
    12. Grouping
    13. Aggregate Functions
    14. Joins
    15. Constructors
  5. Advanced Mappings
    1. Inheritance Strategies
    2. Single-Table Strategy
    3. Joined-Table Strategy
    4. Table-Per-Concrete-Class Strategy
    5. Querying Over Inheritance Relationships
    6. Type Identification with .class
    7. Secondary Tables
    8. Composite Primary Keys
    9. @IdClass and @EmbeddedId
    10. Derived Identifiers
    11. @ElementCollection
    12. Default Values
    13. @Version Fields
    14. Cascading and Orphan Removal
    15. Detachment and Merging
    16. Hibernate Extensions
    17. The @Type Annotation
  6. The Criteria API
    1. History of the Criteria API
    2. Criteria Query Structure
    3. The MetaModel API and Query Type Safety
    4. The Hibernate Metamodel Generator
    5. Tuples
    6. Joins
    7. Predicates
    8. Building Expressions
    9. Ordering
    10. Grouping
    11. Encapsulating Persistence Logic
    12. Façades
    13. Range Queries
  7. Lifecycle and Validation
    1. Lifecycle Events
    2. Method Annotations
    3. Entity Listeners
    4. JSR-303 Validation
    5. The Hibernate Validator
    6. Constraint Annotations
    7. Validation Modes
    8. Validation Groups
  8. Locking and Caching
    1. Concurrency
    2. Optimistic Locking
    3. Optimistic Read Locking
    4. Optimistic Write Locking
    5. Pessimistic Locking
    6. Caching
    7. Persistence Context as Transactional Cache
    8. Shared (2nd-level) Cache
    9. Locking and Caching "Do's and Don'ts"

Class Materials

Each student in our Live Online and our Onsite classes receives a comprehensive set of materials, including course notes and all the class examples.

Class Prerequisites

Experience in the following areas is required:

  • A strong Java programming background is essential for this course
  • Knowledge of relational database concepts and SQL is recommended
  • Prior experience with JDBC will be a plus but is not required.

Technical Requirements

Our computer technical requirements and setup process is easy, with support just a click away.


  • Java ®, all Java-based marks, Hibernate ®, and all Hibernate-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. or its subsidiaries in the U.S. and other countries.
Client Success
  1. Independent Survey
  2. Client List
  3. Testimonials
Join The Team
  1. Learn how you can become a Webucator Trainer
  2. Career Opportunities
Locations
Compare Us
Watch 3-minute Demo Video
of Live Online Training:
Learn the benefits of online training with Webucator
Webucator is a Registered Education Provider (R.E.P.) approved by PMI to issue professional development units (PDUs) for our training courses.
© Webucator, Inc. All rights reserved. | Toll Free: 1-877-932-8228 | From outside the USA: 315-849-2724| Fax: 315-849-2723