Fast Track to the Java Persistence API Version 2 (JPA 2) Training

We offer private customized training for groups of 3 or more attendees.

Course Description

As part of the complete overhaul of the Enterprise JavaBeans (EJB) specification, database persistence was broken out into a completely separate specification, the Java Persistence API (JPA). JPA replaces entity beans with powerful new Object-Relational Mapping (ORM) capabilities based on proven technologies such as Toplink and Hibernate. This course includes all important features from JPA 2, and is also suitable for users of the 1.0 release. JPA supports a POJO (Plain Old Java Object) based model using annotations which lets you develop persistent classes following common Java idioms. It supports entity relationships, inheritance, polymorphism, composition, and much more. The Java Persistence Query Language (JPQL), which is based on SQL but operates on the object model, provides a powerful bridge between the object and relational worlds. JPA also allows you to express queries using native SQL, including the capability to map the SQL query results to persistent entities This course covers everything you need to know to begin working with the Java Persistence API in a very short time. It covers all the important concepts necessary to access and update data stored in relational databases. It includes an extensive series of labs to exercise all major capabilities.
Course Length: 3 Days
Course Tuition: $1290 (US)


One year of Java programming experience (or equivalent) is preferred.

Course Outline


Introduction to Java Persistence API (JPA)

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
Transaction Overview
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
Entity 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
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
The Crietria 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 (Optional)
DAO Overview
JpaUtil Class for EntityManager management in Java SE
Lifecycle Considerations
Integration with EJB (Optional)
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 (Optional)
Injection of EntityManger, EntityManagerFactory
JPA/Spring Based DAO

Course Directory [training on all levels]

Upcoming Classes
Gain insight and ideas from students with different perspectives and experiences.

Java Programming Uses & Stats

Java Programming is Used For:
Android & IOS Development Software Products Video Games Desktop GUI's
Year Created

Most Commonly Used: 
According to Oracle, three billion devices run on Java.  And, because of its real-world applications, it consistently ranks at the top of the TIOBE Programming Community Index. 

Great Career Choice: 
Some of the fastest-growing salaries in the U.S. in 2018 are for Java developers.  (Glassdoor)  

Android Apps Development:
Developers predominatly use their Java skills in building apps for Google's Android. The Android platform is the number one mobile paltform in the world

It Can Run On Any Platform:
Java can compile on Windows and run the same compiled file on Linux, Windows and Mac.

Great Supporting IDE's:
Over the years, coding in Java has become simpler with the introduction of open source development tools, i.e. Eclipse and NetBeans that use Java capabilities for debugging.  


Uses a Lot of Memory:
Performance can be significantly slower with Java and more memory-consuming than natively compiled languages such as C or C++.

Difficulty in Learning: 
Learning Java can be a bit challenging if you are a beginner.  However, once you get the hang of Object Oriented Programming and a decent grasp of the syntax, you will be well on your way.

Slow Start Up Times:
There is quite a bit of one-time initialization done by JDK classes before compiling as well as loading classes and verification (making sure code doesn't do evil things, all of which takes longer that some other languages such as C. 

Verbose and Complex Code:
Long, over-complicated sentences make code less readable and scannable. Compare to let's say Python, we can see how clear Python code appears: It doesn’t require semicolons; uses “and,” “or,” and “not” as operators instead of Java’s “&&,” “||,” and “!”; and generally has fewer bells and whistles such as parentheses or curly braces.

Commercial License Cost:
Companies have to prepare for the changes that Oracle will institute in 2019 . Today, the current version of Java is free and available for redistribution for general purpose computing. However, If you are a DEVELOPER, Oracle recommends you review the roadmap information for Java SE 8 and beyond and take appropriate action depending on the type of application you develop and your distribution mode.

Java Programming Job Market
Average Salary
Job Count
Top Job Locations

New York City 
San Jose
Washington D.C, 

Complimentary Skills to have along with Java Programming

- If you are an experienced Java developer, learning a complimentary language to Java should come much more naturally.  As an example JetBrains recently created the Kotlin programming language which is officially supported by Google for mobile development.  Kotlin compiles to Java bytecode and runs on the JVM; it's purported to address many of Java's shortcomings...

Interesting Reads Take a class with us and receive a book of your choosing for 50% off MSRP.