Implementing persistence with Java Persistence API (JPA)
Programme
Persistence issue
- Object-relational mapping
- Interest of JPA, positioning
- JPA and application servers
- History of solutions, Hibernate, TopLink, EJB
- Java EE: history
- Java EE servers
Persistence model
- Defining a persistent entity, concept of POJO, attributes, relationships
- Entity and Identity
- Life cycle of entities
- Setting up a mapping
- Mapping without annotations
- Mapping with annotations
- Declaring attributes
- Representing different types of relationships between entities
- Embedded class
- 0..1 relation
- 1..N and N..1 relation
- N..M ralation
- CRUD entities handling
- bidirectionality (or inverse relationship)
- Inheritance and polymorphism management
- Mapping an entity on several tables
Lab
- Implementation of the persistence of a model illustrating the different presented configurations
Entity manipulation
- Entity Manager concept
- Transaction management, JTA (java Transaction API)
- Queries: named queries and dynamic queries, Java Persistence Query Language
- Defining query
- Executing query
- Parameterized queries
- JPQL syntax
Lab
- Using JPA querying features
Performance
- Cascade usage
- Loading optimization and Lazy Loading
- Optimistic locking
Conclusion
- Overview of implementations
- Future of Java application servers and persistence