Java Persistence API (JPA)

Have Queries? Ask us +91 72592 22234

Course Overview

Java Persistence API Training offers a comprehensive and detail-oriented treatment of the Java Persistence API (JPA) for developers interested in implementing persistence tiers for enterprise applications. This training 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. Java Persistence API 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 Content


  • Persistence Layers, Object-Relational Mapping (ORM), JDBC
  • JPA Overview

Mapping with JPA

  • Entities and @Entity, ids and @Id
  • Generated Id Values
  • Basic Mapping Types

Persistence Unit and EntityManager

  • Persisting to the DB, the EntityManager API
  • Persistence Units, Config, Persistence Context
  • Retrieving Persistent Entities with find()

More About Mappings

  • Default Mappings, @Basic, @Column
  • Field vs. Property Access
  • Temporal (Date/Time) Mappings

Logging Options (Provider based)
Updates and Queries

  • Inserting and Updating - Persisting new Entities, Updating an Instance, Removing an Instance

Querying and JPQL

  • Entity Based Queries, SELECT ,WHERE
  • Query Interface, Executing Queries, Generic Queries (JPA 2)
  • JPQL Operators, Expressions, and Parameters
  • Named Queries

Additional Query Capabilities

  • Projection query, Ordering, Aggregate Query, Build Update and Delete

Embedded Objects

  • @Embeddable, @Embedded
  • Defining and using Embedded Objects
  • Compound Primary Keys - @EmbeddedID, @IDClass, Defining Compound Keys

The Persistence Lifecycle

  • Transaction Overview and Transactions in JPA
  • EntityTransaction API (including JTA and resource-local EntityManager)
  • The Persistence Lifecycle
    • JPA Entity States (New, Managed, Detached, Removed), and Entity State Diagram
    • Persistence Context - Lifespan, Propagation
    • Synchronization to the DB
  • Versioning and Optimistic Locking
    • Overview, Detached Instances
    • Versioning, @Version, Optimistic Locking
  • Lifecycle Callbacks
    • @PrePersist, @PostPersist, etc.
    • Entity Listeners, @EntityListeners

Enitity Relationships

  • Relationships Overview: Object Relationships, Participants, Roles
  • Directionality, Cardinality
  • Relationship Mapping
  • Mapping Overview (1-1, 1-N, N-1, N-N)
    • Unidirectional and Bidirectional
    • @ManyToOne, @OneToMany, Table Structures
    • Relationship Inverse - Owning Side
    • Collection Types (List, Set, etc)
    • Cascading Over Relationships (including orphanRemoval - JPA 2)
    • @ManyToMany, @OneToOne
    • Lazy and Eager Loading
    • Queries Across Relationships (Inner Joins, Outer Joins, Fetch Joins)
  • Entity Inheritance Mapping
    • Overview
    • Single Table Mapping
    • Joined (Table per Subclass) Mapping
    • Table per Concrete Class Mapping
    • Pros and Cons

Element Collections (JPA 2)

  • Overview, Collections of Value Objects, @ElementCollection, @CollectionTable
  • Using Element Collections
  • Collections of Embeddables

Criteria API (JPA 2)

  • Overview of the Criteria API
  • Path Expressions, Building Queries (CriteriaBuilder, CriteriaQuery, Subquery, Predicate, Expression, Order, Selection, Join)
  • Executing Queries and Accessing Results

Additional JPA Capabilities

  • XML Mapping Files
  • Bean Validation (JPA 2)
  • Best Practices
  • Primary Keys, Named Queries, Lazy/Eager Loading, Transactional Semantics, Encapsulation, Report Queries


  • Data Access Objects (DAO) and Java SE Integration
    • JpaUtil Class for EntityManager management in Java SE
    • Lifecycle Considerations
  • Integration with EJB
    • Using JPA with Session Beans
    • Container Managed (Injected) Entity Manger
    • JTA Transactions and Lifecycle Considerations
    • Extended Persistence Contexts
  • Using JPA with Java Web Apps
    • Using EntityManager in Web apps - request scoping
    • Lazy Loading - Open EntityManager in View Pattern
  • Integration with Spring
    • Injection of EntityManger, EntityManagerFactory
    • LocalEntityManagerFactoryBean
    • JPA/Spring Based DAO

Customer Reviews

Thanks to Xpertised and the tutor who walked me through all the topics with Practical exposure which is helping me in my current project.

Course was quite helpful in terms of understanding of concepts and practicality. Its really a very friendly environment to learn. The timing were mutually chosen, as we both are working professional. I am quite satisfied with the course.


For Batch Details
Call us at: +91 7259222234

Not sure? Consult Our Experts

Looking for a Training for


My Team/Organization

I agree to be contacted over mail or phone

Call us at: +91 7259222234