Part 2. Java Persistence API
Prev
Next
Part 2. Java Persistence API
Table of Contents
1. Introduction
1. Intended Audience
2. Lightweight Persistence
2. Why JPA?
3. Java Persistence API Architecture
1. JPA Exceptions
4. Entity
1. Restrictions on Persistent Classes
1.1. Default or No-Arg Constructor
1.2. Final
1.3. Identity Fields
1.4. Version Field
1.5. Inheritance
1.6. Persistent Fields
1.7. Conclusions
2. Entity Identity
2.1. Identity Class
2.1.1. Identity Hierarchies
3. Lifecycle Callbacks
3.1. Callback Methods
3.2. Using Callback Methods
3.3. Using Entity Listeners
3.4. Entity Listeners Hierarchy
4. Conclusions
5. Metadata
1. Class Metadata
1.1. Entity
1.2. Id Class
1.3. Mapped Superclass
1.4. Embeddable
1.5. EntityListeners
1.6. Example
2. Field and Property Metadata
2.1. Explicit Access
2.2. Transient
2.3. Id
2.4. Generated Value
2.5. Embedded Id
2.6. Version
2.7. Basic
2.7.1. Fetch Type
2.8. Embedded
2.9. Many To One
2.9.1. Cascade Type
2.10. One To Many
2.10.1. Bidirectional Relations
2.11. One To One
2.12. Many To Many
2.13. Order By
2.14. Map Key
2.15. Persistent Field Defaults
3. XML Schema
4. Conclusion
6. Persistence
1. persistence.xml
2. Non-EE Use
7. EntityManagerFactory
1. Obtaining an EntityManagerFactory
2. Obtaining EntityManagers
3. Persistence Context
3.1. Transaction Persistence Context
3.2. Extended Persistence Context
4. Retrieving Properties Information
5. Closing the EntityManagerFactory
6. PersistenceUnitUtil
8. EntityManager
1. Transaction Association
2. Entity Lifecycle Management
3. Lifecycle Examples
4. Entity Identity Management
5. Cache Management
6. Query Factory
7. Retrieving Properties Information
8. Closing
9. Transaction
1. Transaction Types
2. The EntityTransaction Interface
10. JPA Query
1. JPQL API
1.1. Query Basics
1.2. Relation Traversal
1.3. Embeddable Traversal
1.4. Fetch Joins
1.5. JPQL Functions
1.6. Polymorphic Queries
1.7. Query Parameters
1.8. Query Hints
1.8.1. Locking Hints
1.8.2. Lock Timeout Hint
1.8.3. Query Timeout Hint
1.8.4. Result Set Size Hint
1.8.5. Isolation Level Hint
1.8.6. Other Fetchplan Hints
1.8.7. Database-Specific Hints
1.8.8. Named Query Hints
1.8.9. Handling of Multiple Similar Query Hints
1.9. Ordering
1.10. Aggregates
1.11. Named Queries
1.12. Delete By Query
1.13. Update By Query
2. JPQL Language Reference
2.1. JPQL Statement Types
2.1.1. JPQL Select Statement
2.1.2. JPQL Update and Delete Statements
2.2. JPQL Abstract Schema Types and Query Domains
2.2.1. JPQL Entity Naming
2.2.2. JPQL Schema Example
2.3. JPQL FROM Clause and Navigational Declarations
2.3.1. JPQL FROM Identifiers
2.3.2. JPQL Identification Variables
2.3.3. JPQL Range Declarations
2.3.4. JPQL Path Expressions
2.3.5. JPQL Joins
2.3.5.1. JPQL Inner Joins (Relationship Joins)
2.3.5.2. JPQL Outer Joins
2.3.5.3. JPQL Fetch Joins
2.3.6. JPQL Collection Member Declarations
2.3.7. JPQL FROM Clause and SQL
2.3.8. JPQL Polymorphism
2.4. JPQL WHERE Clause
2.5. JPQL Conditional Expressions
2.5.1. JPQL Literals
2.5.2. JPQL Identification Variables
2.5.3. JPQL Path Expressions
2.5.4. JPQL Input Parameters
2.5.4.1. JPQL Positional Parameters
2.5.4.2. JPQL Named Parameters
2.5.5. JPQL Conditional Expression Composition
2.5.6. JPQL Operators and Operator Precedence
2.5.7. JPQL Comparison Expressions
2.5.8. JPQL Between Expressions
2.5.9. JPQL In Expressions
2.5.10. JPQL Like Expressions
2.5.11. JPQL Null Comparison Expressions
2.5.12. JPQL Empty Collection Comparison Expressions
2.5.13. JPQL Collection Member Expressions
2.5.14. JPQL Exists Expressions
2.5.15. JPQL All or Any Expressions
2.5.16. JPQL Subqueries
2.6. JPQL Scalar Expressions
2.6.1. Arithmetic Expressions
2.6.2. String, Arithmetic, and Datetime Functional Expressions
2.6.2.1. JPQL String Functions
2.6.2.2. JPQL Arithmetic Functions
2.6.2.3. JPQL Datetime Functions
2.6.3. Case Expressions
2.6.4. Entity Type Expressions
2.7. JPQL GROUP BY, HAVING
2.8. JPQL SELECT Clause
2.8.1. JPQL Result Type of the SELECT Clause
2.8.2. JPQL Constructor Expressions
2.8.3. JPQL Null Values in the Query Result
2.8.4. JPQL Embeddables in the Query Result
2.8.5. JPQL Aggregate Functions
2.8.5.1. JPQL Aggregate Examples
2.8.5.2. JPQL Numeric Expressions in the SELECT Clause
2.9. JPQL ORDER BY Clause
2.10. JPQL Bulk Update and Delete
2.11. JPQL Null Values
2.12. JPQL Equality and Comparison Semantics
2.13. JPQL BNF
11. JPA Criteria
1. Constructing a CriteriaQuery
2. Executing a CriteriaQuery
3. Extension to Criteria API
4. Generation of Canonical MetaModel classes
12. SQL Queries
1. Creating SQL Queries
2. Retrieving Persistent Objects with SQL
13. Mapping Metadata
1. Table
2. Unique Constraints
3. Column
4. Identity Mapping
5. Generators
5.1. Sequence Generator
5.2. TableGenerator
5.3. Example
6. Inheritance
6.1. Single Table
6.1.1. Advantages
6.1.2. Disadvantages
6.2. Joined
6.2.1. Advantages
6.2.2. Disadvantages
6.3. Table Per Class
6.3.1. Advantages
6.3.2. Disadvantages
6.4. Putting it All Together
7. Discriminator
8. Field Mapping
8.1. Basic Mapping
8.1.1. LOBs
8.1.2. Enumerated
8.1.3. Temporal Types
8.1.4. The Updated Mappings
8.2. Secondary Tables
8.3. Embedded Mapping
8.4. Direct Relations
8.5. Join Table
8.6. Bidirectional Mapping
8.7. Map Mapping
9. The Complete Mappings
14. Conclusion