Realdolmen Education

Details

Java Persistence API 2.1 Advanced

Deze cursus is momenteel niet ingepland op de open kalender, maar kan op aanvraag georganiseerd worden.

Cursus aanvragen

Aantal dagen

2 day(s)

Audience

Java developers who wish to leverage the power of the JPA 2 specification to ease the development of database centric applications.

Prerequisites

Have some understanding of the standard JEE API's. Having some experience with JDBC and SQL can be useful but is not required.

Objectives

Mastering the use of the JPA 2 specification.

Methods

Classroom training with hands-on exercises.

Description

A major enhancement in EJB technology was the addition of the Java Persistence API (JPA), which simplified the entity persistence model and added new capabilities. JPA deals with mapping Java objects or entities to relational data. Objects can then be stored into a database, so that the information can be accessed at a later time. Entity objects can also be used to transfer and keep information available throughout the application. Using JPA results in faster development of applications, by providing a technology that is both easier to use and standardized. JPA 2 builds upon the foundation laid by JPA, and adds a lot of features which were already available to many Object Relational Mapping (ORM) tools but that did not make it into the specification.

JPA 2 features more flexible access modes, orphan removal, ordered lists, collections of primites and embeddables, query enhancements, criteria queries and much more. During the course, participants will gain a thourough understanding on how to create entities and map them to database tables, how to configure the different relationships between entities, and how to manipulate entities and their lifecycle. Afterwards, they will learn the powerful query language used by JPA 2 to fetch data from the database. Next, important topics such as transactions and security are discussed. At the end of this 2-days course, you will have learned how to use the JPA 2 specification effectively, and through instructor-led exercises you will be able to put what you have learned into practice.

By following this course, you will be able to develop database centric application quickly and efficiently, while maintaining an object-oriented approach througout development. Learning JPA 2 is a must for every Java developer!

Contents

  • Introduction

    • The problem
    • The solution
    • What is JPA?
    • JPA versus other persistence schemes in Java
    • JPA Specification Overview
    • What's new in JPA 2.0?
  • Getting started

    • Setting up
    • Create a project
    • Configure JPA
    • Add an entity
    • Adding initial data
    • Adding a BookRepository
    • Create an EntityManager
    • Write unit tests
    • Exercise #01
  • Entities

    • What is an Entity?
    • A Simple Entity
    • Querying Entities
    • Callbacks and Listeners
    • Persisting Entities
    • Configuring Persistence
    • Adding JUnit Tests
    • Exercise #02
  • Mapping simple entities

    • Mapping an Entity
    • Configuration by Exception
    • @Table
    • @SecondaryTable
    • @Id
    • @GeneratedValue
    • Composite Primary Keys
    • @EmbeddedId
    • @IdClass
    • @EmbeddedId vs @IdClass
    • @Basic
    • Exercise #03
    • @Column
    • @Temporal
    • @Transient
    • @Enumerated
    • @Access
    • Exercise #04
    • @ElementCollection & @CollectionTable
    • @MapKeyColumn
    • Mapping with XML
    • @Embeddable & @Embedded
    • Exercise #05
  • Mapping entity relationships

    • Relationship Mapping
    • Relationships in Databases
    • Entity Relationships
    • @OneToOne bidirectional
    • @OneToOne unidirectional
    • @JoinColumn
    • @OneToMany unidirectional
    • @JoinTable
    • @OneToMany unidirectional without Join Table
    • @ManyToMany bidirectional
    • Fetching relationships
    • Default fetching strategies
    • @OrderBy
    • @OrderColumn
    • Exercise #06
  • Mapping inheritance

    • Inheritance Mapping
    • Inheritance Diagram
    • Single-Table-per-Class Hierarchy Strategy
    • Joined-Subclass Strategy
    • Table-per-Concrete-Class Strategy
    • @AttributeOverride
    • Inheriting from Non-Entities
    • @MappedSuperclass
    • Exercise #07
  • The EntityManager API

    • The EntityManager
    • Application-Managed EntityManager
    • Container-Managed EntityManager
    • @PersistenceContext
    • Manipulating Entities
    • Persisting an Entity
    • Finding by ID
    • Removing an Entity
    • Orphan Removal
    • Flushing and Refreshing
    • Contains, Clear and Detach
    • Merging an Entity
    • Updating an Entity
    • Cascading Events
    • Cascading Options
    • Cache API
    • Exercise #08 (Optional)
  • Querying

    • JPQL
    • SELECT
    • Scalar Expressions & FROM
    • WHERE
    • Binding Parameters
    • Subqueries & ORDER BY
    • GROUP BY & HAVING
    • Bulk Delete & Bulk Update
    • Queries
    • Executing the Query
    • Dynamic Queries
    • Named Queries
    • Native Queries
    • Criteria Queries
    • Exercise #09
  • Concurrency

    • Concurrency
    • @Version
    • Optimistic Locking
    • Pessimistic Locking
    • Exercise #10
  • Entity life cycle

    • Entity Life Cycle
    • Callbacks
    • Listeners
    • Exercise #11
  • References

    • References