On this page
- Preface
- System Requirements
- 1. Architecture
- 2. Domain Model
- 3. Bootstrap
- 4. Schema generation
- 5. Persistence Context
- 5.1. Accessing Hibernate APIs from JPA
- 5.2. Bytecode Enhancement
- 5.3. Making entities persistent
- 5.4. Deleting (removing) entities
- 5.5. Obtain an entity reference without initializing its data
- 5.6. Obtain an entity with its data initialized
- 5.7. Obtain multiple entities by their identifiers
- 5.8. Obtain an entity by natural-id
- 5.9. Filtering entities and associations
- 5.10. Modifying managed/persistent state
- 5.11. Refresh entity state
- 5.12. Working with detached data
- 5.13. Checking persistent state
- 5.14. Evicting entities
- 5.15. Cascading entity state transitions
- 5.16. Exception handling
- 6. Flushing
- 7. Database access
- 7.1. ConnectionProvider
- 7.2. Using DataSources
- 7.3. Driver Configuration
- 7.4. Using c3p0
- 7.5. Using Proxool
- 7.6. Using HikariCP
- 7.7. Using Vibur DBCP
- 7.8. Using Agroal
- 7.9. Using Hibernate’s built-in (and unsupported) pooling
- 7.10. User-provided Connections
- 7.11. ConnectionProvider support for transaction isolation setting
- 7.12. Connection handling
- 7.13. Database Dialect
- 8. Transactions and concurrency control
- 9. JNDI
- 10. Locking
- 11. Fetching
- 11.1. The basics
- 11.2. Direct fetching vs. entity queries
- 11.3. Applying fetch strategies
- 11.4. No fetching
- 11.5. Dynamic fetching via queries
- 11.6. Dynamic fetching via JPA entity graph
- 11.7. Dynamic fetching via Hibernate profiles
- 11.8. Batch fetching
- 11.9. The @Fetch annotation mapping
- 11.10. FetchMode.SELECT
- 11.11. FetchMode.SUBSELECT
- 11.12. FetchMode.JOIN
- 11.13. @LazyCollection
- 12. Batching
- 13. Caching
- 13.1. Configuring second-level caching
- 13.2. Configuring second-level cache mappings
- 13.3. Entity inheritance and second-level cache mapping
- 13.4. Entity cache
- 13.5. Collection cache
- 13.6. Query cache
- 13.7. Managing the cached data
- 13.8. Caching statistics
- 13.9. JCache
- 13.10. Ehcache
- 13.11. Infinispan
- 14. Interceptors and events
- 15. HQL and JPQL
- 15.1. Example domain model
- 15.2. Query API
- 15.3. Case Sensitivity
- 15.4. Statement types
- 15.5. Select statements
- 15.6. Update statements
- 15.7. Delete statements
- 15.8. Insert statements
- 15.9. The FROM clause
- 15.10. Identification variables
- 15.11. Root entity references
- 15.12. Explicit joins
- 15.13. Implicit joins (path expressions)
- 15.14. Distinct
- 15.15. Collection member references
- 15.16. Special case - qualified path expressions
- 15.17. Polymorphism
- 15.18. Expressions
- 15.19. Identification variable
- 15.20. Path expressions
- 15.21. Literals
- 15.22. Arithmetic
- 15.23. Concatenation (operation)
- 15.24. Aggregate functions
- 15.25. Scalar functions
- 15.26. JPQL standardized functions
- 15.27. HQL functions
- 15.28. User-defined functions
- 15.29. Collection-related expressions
- 15.30. Entity type
- 15.31. CASE expressions
- 15.32. Simple CASE expressions
- 15.33. Searched CASE expressions
- 15.34. CASE expressions with arithmetic operations
- 15.35. NULLIF expressions
- 15.36. COALESCE expressions
- 15.37. The SELECT clause
- 15.38. Predicates
- 15.39. Relational comparisons
- 15.40. Nullness predicate
- 15.41. Like predicate
- 15.42. Between predicate
- 15.43. In predicate
- 15.44. Exists predicate
- 15.45. Empty collection predicate
- 15.46. Member-of collection predicate
- 15.47. NOT predicate operator
- 15.48. AND predicate operator
- 15.49. OR predicate operator
- 15.50. The WHERE clause
- 15.51. Group by
- 15.52. Order by
- 15.53. Read-only entities
- 15.54. Entity query plan cache
- 16. Criteria
- 17. Native SQL Queries
- 17.1. Creating a native query using JPA
- 17.2. Scalar queries
- 17.3. Entity queries
- 17.4. Handling associations and collections
- 17.5. Returning multiple entities
- 17.6. Alias and property references
- 17.7. Returning DTOs (Data Transfer Objects)
- 17.8. Handling inheritance
- 17.9. Parameters
- 17.10. Named SQL queries
- 17.11. Resolving global catalog and schema in native SQL queries
- 17.12. Using stored procedures for querying
- 17.13. Using named queries to call stored procedures
- 17.14. Custom SQL for CRUD (Create, Read, Update and Delete)
- 18. Spatial
- 19. Multitenancy
- 20. OSGi
- 20.1. OSGi Specification and Environment
- 20.2. hibernate-osgi
- 20.3. features.xml
- 20.4. QuickStarts/Demos
- 20.5. Container-Managed JPA
- 20.6. Enterprise OSGi JPA Container
- 20.7. persistence.xml
- 20.8. DataSource
- 20.9. Bundle Package Imports
- 20.10. Obtaining an EntityManger
- 20.11. Unmanaged JPA
- 20.12. persistence.xml
- 20.13. Bundle Package Imports
- 20.14. Obtaining an EntityMangerFactory
- 20.15. Unmanaged Native
- 20.16. Bundle Package Imports
- 20.17. Obtaining a SessionFactory
- 20.18. Optional Modules
- 20.19. Extension Points
- 20.20. Caveats
- 21. Envers
- 21.1. Basics
- 21.2. Configuration Properties
- 21.3. Additional mapping annotations
- 21.4. Choosing an audit strategy
- 21.5. Revision Log
- 21.6. Tracking entity names modified during revisions
- 21.7. Tracking entity changes at the property level
- 21.8. Selecting strategy for tracking property level changes
- 21.9. Queries
- 21.10. Querying for entities of a class at a given revision
- 21.11. Querying for entities using filtering criteria
- 21.12. Querying for revisions, at which entities of a given class changed
- 21.13. Querying for entity revisions that modified a given property
- 21.14. Querying for revisions of entity including property names that were modified
- 21.15. Querying for entity types modified in a given revision
- 21.16. Querying for entities using entity relation joins
- 21.17. Querying for revision information without loading entities
- 21.18. Conditional auditing
- 21.19. Understanding the Envers Schema
- 21.20. Generating Envers schema with Hibernate hbm2ddl tool
- 21.21. Mapping exceptions
- 21.22. @OneToMany with @JoinColumn
- 21.23. Advanced: Audit table partitioning
- 21.24. Benefits of audit table partitioning
- 21.25. Suitable columns for audit table partitioning
- 21.26. Audit table partitioning example
- 21.27. Determining a suitable partitioning column
- 21.28. Determining a suitable partitioning scheme
- 21.29. Envers links
- 22. Database Portability Considerations
- 23. Statistics
- 24. Configurations
- 24.1. Strategy configurations
- 24.2. General configuration
- 24.3. JPA compliance
- 24.4. Database connection properties
- 24.5. c3p0 properties
- 24.6. Mapping Properties
- 24.7. Bytecode Enhancement Properties
- 24.8. Query settings
- 24.9. Batching properties
- 24.10. Statement logging and statistics
- 24.11. Cache Properties
- 24.12. Infinispan properties
- 24.13. Transactions properties
- 24.14. Multi-tenancy settings
- 24.15. Automatic schema generation
- 24.16. Exception handling
- 24.17. Session events
- 24.18. JMX settings
- 24.19. JACC settings
- 24.20. ClassLoaders properties
- 24.21. Bootstrap properties
- 24.22. Miscellaneous properties
- 24.23. Envers properties
- 24.24. Spatial properties
- 24.25. Internal properties
- 25. Mapping annotations
- 26. Performance Tuning and Best Practices
- 27. Legacy Bootstrapping
- 28. Migration
- 29. Legacy Domain Model
- 30. Legacy Hibernate Criteria Queries
- 30.1. Creating a Criteria instance
- 30.2. JPA vs. Hibernate entity name
- 30.3. Narrowing the result set
- 30.4. Ordering the results
- 30.5. Associations
- 30.6. Dynamic association fetching
- 30.7. Components
- 30.8. Collections
- 30.9. Example queries
- 30.10. Projections, aggregation and grouping
- 30.11. Detached queries and subqueries
- 30.12. Queries by natural identifier
- 31. Legacy Hibernate Native Queries
- 32. References