Consulting Training Blog Careers About Us Contact Us

Java Persistence API (JPA) Training

Course ID: CAP161
Duration: 4 Days

Upcoming Classes

Sorry, nothing scheduled right now. Click the Get Notified button below to be alerted when a class is scheduled.

Get Notified

On Site/Private

Can't find a class that fits right for you? Contact us to inquire about scheduling your own private class

Contact Us

Description

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) 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.

 

Bring This Course To You

For groups of 5 or more, let Intertech bring this course to your location. Customized versions tailored towards your objectives are also available.

Learn More

Learning Objectives

  • 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 context 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 facades 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. 

Prerequisites

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.

 

Course Outline

Introduction to JPA

  • Object/Relational Mapping
  • Mismatches Between Relational and Object Models
  • The Java Persistence API
  • JPA History
  • JPA Architecture
  • Entity Metadata
  • The Entity Manager
  • JPA Providers

Object/Relational Mapping

  • Annotations
  • JavaBean Standards
  • Property, Field, and Mixed Access
  • Table and Column Mapping
  • Primary Keys and Generation
  • Type Mappings
  • Temporal and Enumerated Types
  • Embedded Types
  • Entity Relationships
  • @ManyToOne Relationships
  • @OneToOne Relationships
  • @OneToMany Relationships
  • @ManyToMany Relationships
  • Eager and Lazy Loading

Entity Managers

  • Putting Entities to Work
  • persistence.xml
  • Entity State and Transitions
  • Managing Transactions
  • Persistence Operations
  • Creating Queries
  • Named Queries
  • Query Parameters
  • Native Queries

JPQL

  • The Java Persistence Query Language
  • Query Structure
  • Path Expressions
  • Filtering
  • Scalar Functions
  • Operators and Precedence
  • between, like, in
  • is null, is empty
  • Ordering
  • Aliases
  • Grouping
  • Aggregate Functions
  • Joins
  • Constructors
 

Advanced Mappings

  • Inheritance Strategies
  • Single-Table Strategy
  • Joined-Table Strategy
  • Table-Per-Concrete-Class Strategy
  • Querying Over Inheritance Relationships
  • Secondary Tables
  • Composite Primary Keys
  • @IdClass and @EmbeddedId
  • Derived Identifiers
  • @ElementCollection
  • Default Values
  • @Version Fields
  • Cascading and Orphan Removal
  • Detachment and Merging

The Criteria API

  • History of the Criteria API
  • Criteria Query Structure
  • The MetaModel API and Query Type Safety
  • Tuples
  • Joins
  • Predicates
  • Building Expressions
  • Ordering
  • Grouping
  • Encapsulation Persistence Logic
  • Facades
  • Range Queries

Lifecycle and Validation

  • Lifecycle Events
  • Method Annotations
  • Entity Listeners
  • JSR-303 Validation
  • Constraint Annotations
  • Validation Modes
  • Validation Groups

Locking and Caching

  • Concurrency
  • Optimistic Locking
  • Optimistic Read Locking
  • Optimistic Write Locking
  • Pessimistic Locking
  • Caching
  • Persistence Context as Transactional Cache
  • Shared (2nd-level) Cache
  • Locking and Caching "Do's and Don'ts"

Free Resources from Intertech

Complete Guide to Becoming a Full Stack Developer

Free Book Chapter: Spring Web

2 Free Resources: Missed Issues in Software Estimation and Stakeholder Questionnaire

X