Enterprise Java Development@TOPIC@

Java Persistence API: Entity Mapping Exercise

Mapping POJOs to RDBMS Tables

Revision: v2013-08-19

2014-03-07 00:01 EST

Abstract

This document contains a series of exercises for mapping Java classes (without relationships) to the database using JPA. It covers many of the core and corner mapping issues and demonstrates various issues that come up.


Purpose
1. JPA Entity Exercise Setup
1.1. Setup Maven Project
2. JPA Entity Class Basics
2.1. Create POJO Class using descriptor
2.2. Create POJO Class using annotations
2.3. Summary
3. Mapping Class Properties
3.1. Map Entity to Specific Table
3.2. Using JPA Property Access
3.3. Summary
4. JPA Enum Mapping
4.1. Mapping Enum Ordinal Values
4.2. Mapping Enum Name Values
4.3. Mapping Enum Alternate Values
4.4. Summary
5. Mapping Temporal Types
5.1. Mapping Temporal Types
5.2. Summary
6. Mapping Large Objects
6.1. Mapping CLOBS
6.2. Mapping BLOBS
6.3. Summary
7. Primary Key Generation
7.1. IDENTITY Primary Key Generation Strategy
7.2. SEQUENCE Primary Key Generation Strategy
7.3. TABLE Primary Key Generation Strategy
7.4. Summary
8. Mapping Compound Primary Keys
8.1. Using Embedded Compound Primary Keys
8.2. Using Compound Primary Keys as IdClass
8.3. Summary
9. Mapping Embedded Objects within Classes
9.1. Mapping an Embedded Object
9.2. Mapping Muti-level Embedded Objects
9.3. Summary
10. Objects Mapped to Multiple Tables
10.1. Mapping to Secondary Tables
10.2. Summary