JPA Training: The Java Persistence API

This course offers a comprehensive and detail-oriented treatment of the Java Persistence API (JPA) 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), working with a JPQL console. The course then moves into advanced mapping techniques, the Criteria API, lifecycle hooks, validation, locking, and caching. Students will complete the course with a firm understanding of JPA architecture and plenty of hands-on experience.

This version of the course supports JPA 2.1 with a choice of two providers: EclipseLink 2.6, which is pre-configured for course exercises, and Hibernate® 5.0. Switching providers is just a matter of moving a few lines in and out of XML comments in the relevant persistence.xml file, and we encourage instructors to demonstrate both providers, to illustrate portability and for comparison of some finer points.

The course also 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.

  1. Understand the value of object/relational mapping and JPA's role as a standard for ORM implementations.
  2. Develop JPA entities using JPA annotations to align the Java classes, properties, and types to relational tables, columns, and types.
  3. Create entity managers and instantiate persistence contexts to perform create/retrieve/update/delete (CRUD) operations.
  4. Implement entity relationships of all cardinalities, including unidirectional and bidirectional relationships.
  5. Map composite primary keys, inheritance relationships, eager/lazy fetching, and cascading operations.
  6. Use JPQL to write object-oriented queries, and process query results.
  7. Use the Criteria API to define queries programmatically, and take advantage of type safety using the Metamodel API.
  8. Build reusable façades that encapsulate simpler and more complex persistence operations.
  9. Implement persistence lifecycle event handlers.
  10. Define JSR-303 validation constraints on JPA entities and see them enforced by the JPA provider.
  11. Manage concurrent opertaions via optimistic or pessimistic locking strategies.
  12. Understand the actions of the local and shared entity caches, and use them appropriately while avoiding over-caching pitfalls.
  1. Introduction to JPA
    1. Object/Relational Mapping
    2. Mismatches Between Relational and Object Models
    3. The Java Persistence API
    4. JPA Architecture
    5. Entity Metadata
    6. The Entity Manager
    7. JPA Providers
  2. Single-Table Mapping
    1. Annotations
    2. JavaBean Standards
    3. Property, Field, and Mixed Access
    4. Table and Column Mapping
    5. Primary Keys and Key Generation
    6. Type Mappings
    7. Temporal and Enumerated Types
    8. Embedded Types
    9. Converters
  3. Mapping Associations
    1. @Embeddable Types
    2. Entity Relationships
    3. @ManyToOne Relationships
    4. @OneToOne Relationships
    5. @OneToMany Relationships
    6. @ManyToMany Relationships
    7. Eager and Lazy Loading
  4. 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
    10. Stored-Procedure Queries
  5. JPQL
    1. The Java Persistence Query Language
    2. Query Structure
    3. Path Expressions
    4. Filtering
    5. Scalar Functions
    6. Using Native 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. Fetch Joins
    16. Constructors
    17. Updates and Deletes
  6. Persistence Components
    1. Encapsulating Persistence Logic
    2. Design Considerations
    3. Testability
    4. Transaction Control
    5. Exception Handling
    6. Generic Types
  7. 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. Secondary Tables
    7. Composite Primary Keys
    8. @IdClass and @EmbeddedId
    9. Derived Identifiers
    10. @ElementCollection
    11. Default Values
    12. @Version Fields
    13. Cascading and Orphan Removal
    14. Detachment and Merging
  8. The Criteria API
    1. History of the Criteria API
    2. Criteria Query Structure
    3. The MetaModel API and Query Type Safety
    4. Tuples
    5. Joins
    6. Predicates
    7. Building Expressions
    8. Ordering
    9. Grouping
    10. Encapsulating Persistence Logic
    11. Façades
    12. Range Queries
    13. Updates and Deletes
  9. Lifecycle
    1. Lifecycle Events
    2. Method Annotations
    3. Entity Listeners
  10. Validation
    1. JSR-303 Validation
    2. Constraint Annotations
    3. Validation Modes
    4. Validation Groups
    5. Handling Validation Exceptions
  11. Locking
    1. Concurrency
    2. Updates to the Same and Related Entities
    3. Pessimistic Locking
    4. Lock Types
    5. Who Blocks Whom
    6. Deadlocking and Timeouts
    7. Optimistic Locking
    8. The @Version Annotation
    9. Optimistic Read and Write Locking
    10. Error Handling
    11. Combining Locking Strategies
  12. Caching
    1. Caching
    2. Persistence Context as Transactional Cache
    3. Shared (2nd-Level) Cache
    4. Pros and Cons
    5. Cache Configuration
    6. Eviction
    7. Effects of Locking on Caching
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 is required for this Java EE class:

  • 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.
Preparing for Class

Training for your Team

Length: 5 Days
  • Private Class for your Team
  • Online or On-location
  • Customizable
  • Expert Instructors

Training for Yourself

$2,375.00 or 4 vouchers

Upcoming Classes

  • See More Classes

Please select a class.
  • Live Online Training
  • For Individuals
  • Expert Instructors
  • Guaranteed to Run
  • 100% Free Re-take Option
  • 1-minute Video

What people say about our training

Loved the hands on training and ability to ask questions.
Tammy Ellis
Wheeler Mission Ministries
Enjoyed the class. Always wanted to attend an advanced SQL class and this one met my needs for writing advanced queries in Oracle SQL.
Deborah Doncals
PNC Financial Services Group
Very effective teacher.
Donald Platzer
Gallagher Fluid Seals, Inc
The course was great. I really enjoyed the combination of instructions, examples, and in-class exercises.
Anthony Wu
California Resources Corporation

No cancelation for low enrollment

Certified Microsoft Partner

Registered Education Provider (R.E.P.)

GSA schedule pricing


Students who have taken Instructor-led Training


Organizations who trust Webucator for their Instructor-led training needs


Satisfaction guarantee and retake option


Students rated our JPA Training: The Java Persistence API trainers 10.00 out of 10 based on 1 reviews

Contact Us or call 1-877-932-8228