Introduction to Spring 5 and JPA 2

This course uses the latest version Spring 5. This course is also available for Spring 4: Introduction to Spring 4 and JPA 2.

This Introduction to Spring 5 and JPA 2 training class includes coverage of all the core Spring 5 and JPA 2 capabilities, as well as the integration capabilities provided by Spring. It provides extensive coverage of using Spring and JPA together, as well as using Spring Boot for dependency management and creating JPA-based repositories using Spring Data. All capabilities are practiced via an extensive set of hands-on labs.

This course covers all basic JPA concepts, including mapping persistent classes, and using EntityManager and EntityManagerFactory to access and manipulate persistent entities. Querying with the Java Persistence Query Language (JPQL) is covered in depth, from basic queries to more advanced queries like eager queries using left joins. It also includes coverage of advanced concepts such as collections of value objects, relationships, and inheritance and polymorphic queries.


Public Classes: Delivered live online via WebEx and guaranteed to run . Join from anywhere!

Private Classes: Delivered at your offices , or any other location of your choice.

Course Topics
  1. Understand the core principles of Spring, and of Dependency Injection (DI) / Inversion of Control
  2. Use the Spring Core module and DI to configure and wire application objects (beans) together
  3. Know the different types of metadata (XML, annotations/@Component, and Java Configuration/@Configuration), and how and when to use them
  4. Understand and use the complete capabilities of the Core module, such as lifecycle events, bean scopes, and the Spring API
  5. Use Spring Boot to simplify dependency management and configuration
  6. Understand the benefits of JPA and the JPA Architecture
  7. Create JPA based applications
  8. Work with the ORM (Object-Relational Mapping) module to integrate Spring with JPA.
  9. Understand and use Spring's transaction support, including the easy-to-use Java annotation support, as well as the tx/aop XML configuration elements
  10. Understand and use JPA mapping to map persistent objects to the database
  11. Work with JPA queries and JPQL
  12. Understand and work with collections and associations (Value and entity types, unidirectional, bidirectional, 1-1, 1-N, N-N
  13. Use JPA's versioning support
  14. Map inheritance hierarchies using JPA
  15. Integrate Spring/JPA with Java EE Web applications
  16. Use Spring Data to automatically generate JPA-based repositories with auto-generated queries
  1. Introduction to Spring
    1. Overview of Spring Technology
      1. Motivation for Spring, Spring Architecture
      2. The Spring Framework
    2. Spring Introduction
      1. Declaring and Managing Beans
      2. ApplicationContexts - The Spring Container
      3. XML and @Component/@Named Config
    3. Dependencies and Dependency Injection (DI)
      1. Examining Dependencies
      2. Dependency Inversion / Dependency Injection (DI)
      3. DI in Spring - XML and @Autowired
  2. Configuration in Depth
    1. Java Based Configuration (@Configuration)
      1. Overview, @Configuration, @Bean
      2. Dependency Injection
      3. Resolving Dependencies
    2. Integrating Configuration Types
      1. XML and @Component Pros/Cons
      2. @Configuration Pros/Cons
      3. Choosing a Configuration Style
      4. Integrating with @Import and <import>
    3. Bean Scope and Lifecycle
      1. Singleton, Prototype, and Other Scopes
      2. Configuring Scope
      3. Bean Lifecycle / Callbacks
    4. Externalizing Properties
      1. Properties Files
      2. @PropertySource, property-placeholder
      3. Using @Value
      4. SpEL
    5. Profiles
      1. Overview and Configuration
      2. Activating Profiles
  3. Spring Boot Overview
    1. maven and Spring
    2. Spring Boot Structure
    3. Spring POMs with Boot Parents
    4. Spring Boot Starters
    5. Other Capabilities
  4. Spring Testing
    1. Testing and JUnit Overview
      1. Writing Tests - Test Classes, asserts, Naming Conventions
      2. Running Tests - IDE, maven, ...
      3. Test Fixtures - setup and teardown
    2. Spring TestContext Framework
      1. Overview
      2. Configuration
      3. Running Tests
  5. Introduction to Java Persistence API (JPA2)
    1. Overview
      1. Persistence Layers, Object-Relational Mapping (ORM), JDBC
      2. JPA Overview
    2. Mapping with JPA
      1. Entities and @Entity, ids and @Id,
      2. Generated Id Values
      3. Basic Mapping Types
    3. Mapping with JPA
    4. Persistence Unit and EntityManager
      1. Persisting to the DB, the EntityManager API
      2. Persistence Units, Config, Persistence Context
      3. Retrieving Persistent Entities with find()
    5. Mapping with JPA
    6. More About Mappings
      1. Default Mappings, @Basic, @Column
      2. Field vs. Property Access
      3. Temporal (Date/Time) Mappings
      4. Java 8 Data/Time Mapping
    7. Mapping with JPA
    8. equals() and hashCode()
    9. Logging Options (Provider based)
  6. Spring/JPA Integration
    1. Spring's DataSource Support
    2. Managing the EntityManager (EM)
    3. LocalContainerEntityManagerFactoryBean and Container-managed EMs
    4. JEE and JNDI Lookup of the EM
    5. Configuration and Vendor Adaptors
    6. Creating a JPA Repository/DAO Bean - @PersistenceUnit, @PersistenceContext
  7. JPA Updates and Queries
    1. Inserting Updating, and Deleting Entities
    2. Querying and JPQL
      1. Entity Based Queries, SELECT ,WHERE
      2. Query Interface, Executing Queries, Generic Queries (JPA 2)
      3. JPQL Operators, Expressions, and Parameters
      4. Named Queries
    3. Additional Query Capabilities - Projection and Aggregate Query, Embedded Objects
  8. Transactions
    1. TX Overview and JPA Transactions
    2. Spring's Declarative TX Management (REQUIRED, etc.)
    3. @Transactional
    4. TX Scope and Propagation
    5. Pointcut-based Configuration of Transactions
  9. The JPA Persistence Lifecycle
    1. The Persistence Lifecycle
      1. JPA Entity States (New, Managed, Detached, Removed), and Entity State Diagram
      2. Persistence Context - Lifespan, Propagation
      3. Synchronization to the DB
    2. Versioning and Optimistic Locking
      1. Overview, Detached Instances
      2. Versioning, @Version, Optimistic Locking
    3. Versioning and Optimistic Locking
    4. Lifecycle Callback
      1. @PrePersist, @PostPersist, etc.
      2. Entity Listeners, @EntityListeners
    5. Versioning and Optimistic Locking
  10. Relationships
    1. Relationships Overview: Object Relationships, Participants, Roles, Directionality, Cardinality
    2. Relationship Mapping
      1. Mapping Overview (1-1, 1-N, N-1, N-N)
      2. Unidirectional and Bidirectional
      3. @ManyToOne, @OneToMany, @ManyToMany, @OneToOne with Table Structures
      4. Relationship Inverse - Owning Side
      5. Collection Types (List, Set, etc)
      6. Cascading, Lazy and Eager Loading
      7. Queries Across Relationships (Inner Joins, Outer Joins, Fetch Joins)
    3. Entity Inheritance Mapping
      1. Overview
      2. Single Table, Joined (Table per Subclass), Table per Concrete Class Mappings
      3. Pros and Cons of Mapping Strategies
  11. Spring Web Integration
    1. Integrating Spring with Java EE Web Apps
      1. ContextLoaderListener
      2. WebApplicationContext
      3. Using Spring beans in Wep app controller logic
    2. Open EntityManager in View
      1. Lazy Loading Issue in Web Apps
      2. Open EntityManager in View Pattern
      3. Using Spring's OpenEntityManagerInViewFilter/Interceptor
  12. Spring Data Introduction
    1. Spring Data Overview
      1. Overview and Architecture
      2. Configuring Spring Data
      3. Repositories and JPA Repositories
      4. Using CrudRepository
    2. Using Spring Data
      1. Naming Conventions for Querying
      2. Creating more Complex Queries
      3. Query Configuration
  13. Additional Topics
    1. Spring 5: Core Updates
    2. JPA: Embedded Objects
    3. JPA: Compound Primary Keys
    4. JPA: Element Collections
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 Spring class:

  • Good practical Java programming skills, including use of inheritance and interfaces.
  • Some familiarity with SQL and databases.

Training for Yourself

$2,875.00 or 5 vouchers

Upcoming Live Online Classes

  • See More Classes

Please select a class.

Training for your Team

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

What people say about our training

Great course. The class uses a very nuts-and-bolts approach. Very practical instruction.
Eric Riddle
Nationwide Insurance
Excellent teacher!
Gene Mitchell
US Courts
The instructor was excellent! She took her time and answered all questions. If she did not have the answer, she found it.
Nita Worley
It was fantastic to learn and get comfortable with Google Analytics wearing my slippers.
Cliff Arceneaux

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 trainers 9.30 out of 10 based on 30,409 reviews

Contact Us or call 1-877-932-8228