JPA 1.0 Mapping I (Java EE 5)
Agenda
- Entity Relationships
- Directionality
- Cardinality
- Inheritance (will be covered in “JPA Mapping II”)
Entity Relationships
Aspects of Entity Relationships
- Directionality
- Uni-directional
- Bi-directional
- Cardinality relationships
- One to one
- One to many
- Many to many
- Inheritance relationship
- Single-table
- Joined-table
Entity Relationships: Java vs. Table
- Relationship between entities in Java code is normal object relationship
- Relationship among tables can be represented in two forms
- Join table
- Foreign key
- You can control how the object relationship between Java objects can be mapped into tables through JPA annotations