Implementing Java persistence with Hibernate
Programme
Objectives
- Defining of object persistence
- Classes, mapping file, configuration, object life cycle
- Mapping of unidirectional/bidirectional associations and collections
Hibernate architecture
- Layer view
- Instance life cycle
- JNDI, JDBC, JTA integration
- Session management
Configuration
- APIs for programmatic configuration
- Opening sessions
- JDBC connection management
- SQL dialects, second level cache and query cache
- XML configuration file
- Integration with a Java EE application server
Defining persistent classes
- Plain Old Java Object (POJO)
- Using inheritance
- Redefining equals and hashCode methods
Basics of Object Relational Mapping
- Mapping declarations
- Types used by Hibernate
- Several mappings for the same class
- Java 5 annotations
Defining the persistence of collections
- Persistent collections types
- Foreign keys, elements and indexes of a collection
- Associations *..* and 1..*
Establishing the persistence of associations
- Unidirectional associations
- Bidirectional associations
- Complex mappings
Establishing the persistence of inheritance relationships
- Different strategies
- Using a discriminant
- Management of polymorphism
- Comparing strategies, advantages and disadvantages, when to use them
Hibernate Query Language (HQL) and management of persistent objects
- Storing and loading an object
- HQL language syntax, from, select, where, order by, group by clauses
- Joins, aggregation, polymorphic queries
- Nested queries
- Good practices
- Externalization of named queries
- Lazy loading of properties
- Managing the second level cache
- Query cache