Overview
This 3-day course is designed to equip the participants with the required skills and knowledge to design and develop Java applications effectively and use Hibernate to manage data persistence. This course is helpful in providing the participants with the know–how on designing and building their own Hibernate-enabled applications. The course explores the key Hibernate capabilities and focuses on combining Hibernate with other technologies and frameworks. The areas addressed in this course range from data/class mapping and persisted object lifecycle and management to how to query for persistent objects.
What You'll Learn
- Explain how the issues associated with object persistence in a relational model are addressed by Hibernate
- Understand the relationships between SQL, Java, JDBC, Spring, Java Persistence API, EJB 3.0, and Hibernate
- Write applications that take advantage of the Hibernate Persistence Manager.
- Map Java classes to relational tables.
- Capture both relational and inheritance associations in metadata using either XML or the Java Annotation mechanism.
- Create and use mappings between Java classes and relational databases.
- Understand how identity and keys are handled in Hibernate.
- Understand the persistent object lifecycle and how that relates to transactions and concurrency.
- Become familiar with the mapping of entity associations to database tables
- Query for data using the Java Persistence Query Language (JPQL) and the Criteria API
Curriculum
- Introducing Hibernate
- Understand the goals of ORM frameworks
- Define Object to Relational (O/R) Mapping
- Explain the requirements of JPA Entities
- Defining persistent properties
- Tutorial: Setup Eclipse for Using Maven
- The nuts and bolts of Hibernate
- Setup Hibernate (modules and artifacts)
- Configure Hibernate
- DDL management
- SessionFactory and Session
- Bootstrapping Hibernate
- Mapping a simple entity
- Explain the entity life-cycle
- Methods to control the life-cycle
- Tutorial: Using the Eclipse SQL Database Development Perspective
- Exercise: Getting Started with Hibernate
- Configure persistent classes
- Hibernate Types
- Object identity
- Generating the primary key
- Declaring persistence
- Mapping enumerations
- Converting attributes to database types
- Exercise: Basic ORM
- Define compound Primary Keys
- Understand Hibernate’s basic type mapping
- Customize type mapping
- Map single entity to multiple tables
- Exercise: Advanced ORM
- Mapping Aggregates (One-to-One)
- @Embeddable
- Collection mapping
- Mapping Aggregates (One-to-Many)
- Exercise: Embeddables
- The relationship between JPA and Hibernate
- The persistence.xml
- Configuring the persistence framework
- Introduce transaction Management
- The EntityManager
- Differences between SessionFactory and EntityManager
- Exercise: Setup JPA
-
JPA Callback annotations and methods
Entity life-cycle notifications
Exercise: Adding JPA Callbacks
- Different types of associations
- unidirectional and bidirectional associations
- The owning-side of the relationship
- Map one-to-one relations
- Exercise: OneToOne associations
- Mapping One-to-Many/Many-to-One Associations
- Introduce different mapping strategies
- Cascading operations
- Mapping Many-to-Many associations
- Exercise: Mapping One To Many Relationships
- Inheritance ORM strategies
- @DiscriminatorValue and @DiscriminatorFormula
- Exercise: Mapping Inheritance
- Use JPQL to select data
- Query and TypedQuery
- Obtaining query results
- Query parameter binding
- Named queries
- Different clauses of JPQL query
- Use JPQL to Update or Delete
- Exercise: Using JPQL
- Introduce the Criteria API
- Explain the need for an additional API for creating statements
- The Criteria Meta Model
- Selecting data using the Criteria API
- Use the Criteria API for batch updates and deletes
- Exercise: Using the Criteria API
- Tutorial: Configuring the JPA Annotation Processor
- Explain Query by Example
- Use QBE to search for data
- Exercise: Query by Example
Who should attend
- Java developers
- Full stack developers
- Application developers
- Software developers
- Software engineers