This is an example of a simple banner

Training: Introduction to Data Persistence with JPA

Ref. JPA
Duration:
3
 jours
Exam:
Not certifying
Level:
Intermédiaire

Training Introduction to Data Persistence with JPA

The course Introduction to Data Persistence with JPA offers a clear and progressive understanding of the Java Persistence API framework. This training guides you step by step to learn how to manage object persistence in a modern Java application. With this approach, you will understand how to effectively connect your POJO classes to a relational database.

Why learn JPA now

JPA technology is based on the concept of object-relational mapping. It simplifies data management and avoids writing complex SQL code. You will discover fundamental concepts such as entities, primary keys, relationships, and the lifecycle of persistent objects. These skills are essential for developing robust and scalable applications.

Participant Profiles

  • Beginner Java developers
  • Programmers aiming to master data persistence
  • Computer science students focused on software development
  • Early-career software engineers

Objectives

  • Understand how to persist your class POJO’s with relational database using JPA Object-Relational mapping technology
  • Be confident for implementing and maintaining Object-Relational persistence in your JPA application, including all necessary client-side and server-side programming

Prerequisites

  • Have an intermediate knowledge of Java
  • Master the basics of SQL and relational databases
  • Understand the principles of JDBC and building simple web applications

Course Content

Module 1: Introduction to the Java Persistence API (JPA)

  • Persistence layers, object-relational mapping (ORM), JDBC
  • Overview of JPA
  • Entities and @Entity, ids and @Id
  • Generated ID values
  • Basic mapping types
  • Persistence to the database, the EntityManager API
  • Persistence units, configuration, persistence context
  • Finding persistent entities with find()
  • Default mappings, @Basic, @Column
  • Field vs Property Access
  • Temporal mappings (date / time)
  • Logging options (provider-based)

Module 2: Updates and Queries

  • New persistent entities, update and delete
  • Entity-based queries, SELECT, WHERE
  • Query interface, execution and generic queries
  • JPQL operators, expressions and parameters
  • Named queries
  • Projection, ordering, aggregation, update and delete
  • @Embeddable, @Embedded and embedded objects
  • Composite primary keys with @EmbeddedID and @IDClass

Module 3: The Persistence Lifecycle

  • Overview of the Transaction API
  • EntityTransaction, JTA and Resource-local EntityManager
  • JPA entity states and state diagram
  • Persistence context and synchronization
  • Version, @Version and optimistic locking
  • @PrePersist, @PostPersist and Entity Listeners

Module 4: Entity Relationships

  • Object relationships, roles, directionality and cardinality
  • @ManyToOne, @OneToMany, @ManyToMany, @OneToOne
  • Unidirectional and bidirectional relationships
  • Collection types and cascading
  • Inner joins, outer joins and fetch joins
  • Entity inheritance mapping
  • Single table, joined and concrete class mapping
  • Value object collections with @ElementCollection

Module 5: The Criteria API (JPA 2)

  • Overview of the Criteria API
  • CriteriaBuilder, CriteriaQuery, Subquery and Predicate
  • Executing queries and retrieving results

Module 6: Additional JPA Capabilities

  • XML Mapping files
  • Bean Validation
  • Primary keys, named queries and lazy loading
  • Transactional semantics and encapsulation
  • Report queries and best practices

Module 7: Integration

  • DAO integration and EntityManager management in Java SE
  • Using JPA with EJB session beans
  • JTA transactions and extended persistence contexts
  • EntityManager in web applications
  • Lazy loading and Open EntityManager
  • Integration with Spring and EntityManager injection

Documentation

  • Digital courseware included

Complementary Courses

Eligible Funding

ITTA is a partner of a continuing education fund dedicated to temporary workers. This fund can subsidize your training, provided that you are subject to the “Service Provision” collective labor agreement (CCT) and meet certain conditions, including having worked at least 88 hours in the past 12 months.

Additional Information

JPA, an essential tool for Java developers

Managing data persistence is a major challenge in any software project. Developers must ensure consistency between their Java objects and the data stored in a relational database. Without a dedicated tool, this task involves a lot of complex and repetitive code. This is where JPA comes in. As a standard specification, it helps unify and simplify the process. By adopting it, companies reduce maintenance costs and improve the quality of their applications.

The practical benefits of data persistence

Using JPA is not limited to simplifying code writing. This framework brings real value to projects. It makes applications more scalable and easier to maintain. The clear separation between business logic and data access facilitates future evolutions. Developers can focus on features instead of managing complex SQL queries. This abstraction also reduces the risk of errors and improves application security.

Understanding entities and their lifecycle

At the heart of JPA are entities. These are Java classes directly associated with database tables. Understanding their lifecycle is essential for any developer. An entity can be new, managed, detached, or removed. Each state has a direct impact on how the application interacts with the database. By mastering this mechanism, a programmer can precisely control transactions and avoid data inconsistencies.

The power of object relationships

In a real project, it is rare to manipulate isolated objects. Applications often require complex relationships, such as a customer linked to multiple orders. JPA provides complete management of these associations with simple annotations such as @OneToMany or @ManyToOne. These relationships make it possible to faithfully represent the business model in the database. For development teams, this means better readability and code closer to the functional reality.

Building effective queries with JPQL and the Criteria API

An application cannot function without queries. With JPA, two main approaches are possible. The first uses JPQL, a language close to SQL but object-oriented. The second relies on the Criteria API, which allows dynamically generating queries via Java code. This flexibility is valuable for applications requiring complex or evolving filters. By mastering these tools, a developer can create powerful and high-performance solutions tailored to business needs.

Optimizing performance with best practices

Data persistence should not compromise application performance. JPA provides several mechanisms to optimize processing. Lazy loading prevents unnecessarily retrieving large amounts of data. Optimistic locking ensures efficient management of concurrent access without unnecessarily blocking users. Developers also discover the benefits of second-level caching and named queries. These techniques help reduce database load and improve overall responsiveness.

A framework suited to modern environments

JPA integrates naturally into different contexts. It works equally well in a standalone Java SE application as in a web application based on enterprise servers. It pairs perfectly with frameworks like Spring, which facilitate transaction management and dependency injection. Thanks to this flexibility, it is used in a wide variety of projects, from small internal applications to large-scale critical solutions.

Why learning JPA is a professional asset

Mastering JPA is a sought-after skill in the world of Java development. Companies value profiles capable of designing reliable and maintainable applications. Taking a JPA training course provides solid knowledge directly applicable in the workplace. It also prepares developers for advanced Java certifications. Finally, this expertise opens the way to more specialized positions, such as application architect or senior software engineer.

FAQ

Is JPA a framework or a specification?
JPA is a specification. It defines a standard, and several frameworks such as Hibernate or EclipseLink are its implementations.

What is the difference between JPA and Hibernate?
Hibernate is an implementation of JPA. Learning JPA therefore allows you to use Hibernate, but also other compatible solutions.

Can JPA be used in microservices?
Yes, JPA is compatible with modern architectures. It integrates easily with Spring Boot, which is widely used for microservices.

What are the main advantages of JPA?
JPA reduces code complexity, improves productivity, and ensures better consistency between objects and the database.

Prix de l'inscription
CHF 2'150.-
Inclus dans ce cours
  • Training provided by an industry expert
  • Digital documentation and materials
  • Achievement badge
Mois actuel

lun29Sepmer01OctVirtuelVirtual Etiquettes de sessionJPA

lun29Sepmer01OctGenève, Route des Jeunes 35, 1227 Carouge Etiquettes de sessionJPA

lun03Nov(Nov 3)09:00mer05(Nov 5)17:00VirtuelVirtual Etiquettes de sessionJPA

lun03Nov(Nov 3)09:00mer05(Nov 5)17:00Lausanne, Avenue Mon repos 24, 1005 Lausanne Etiquettes de sessionJPA

lun08Déc(Déc 8)09:00mer10(Déc 10)17:00VirtuelVirtual Etiquettes de sessionJPA

lun08Déc(Déc 8)09:00mer10(Déc 10)17:00Genève, Route des Jeunes 35, 1227 Carouge Etiquettes de sessionJPA

Contact

ITTA
Route des jeunes 35
1227 Carouge, Suisse

Opening hours

Monday to Friday
8:30 AM to 6:00 PM
Tel. 058 307 73 00

Contact-us

ITTA
Route des jeunes 35
1227 Carouge, Suisse

Make a request

Contact

ITTA
Route des jeunes 35
1227 Carouge, Suisse

Opening hours

Monday to Friday, from 8:30 am to 06:00 pm.

Contact us

Your request