Hibernate should be the least of your worries as interview questions are limited. Just cover these 20 topics and 20 questions in my Java book, and you should be good 👍
1. Introduction to Hibernate: Advantages over JDBC, ORM concepts.
2. Hibernate Architecture: Key components (SessionFactory, Session, Transaction).
3. Configuration: Setting up hibernate.cfg.xml and properties.
4. Hibernate Annotations: Basic annotations like @ Entity, @ Table, @ Id.
5. Session and SessionFactory: Lifecycle, best practices, and differences.
6. Mappings:
One-to-One: Using @ OneToOne.
One-to-Many and Many-to-One: @ OneToMany, @ ManyToOne.
Many-to-Many: Bidirectional relationships using @ JoinTable.
7. Hibernate Query Language (HQL): Writing queries and differences from SQL.
8. Criteria API: Programmatically building queries.
9. Caching:
First-level cache.
Second-level cache using EHCache, Redis, etc.
10. Inheritance Mapping:
Single Table, Table-per-Class, and Joined strategy.
11. Fetching Strategies:
Eager vs Lazy fetching.
12. Transactions and Concurrency: Handling distributed transactions and isolation levels.
13. Optimistic and Pessimistic Locking: Use cases and implementation.
14. Batch Processing: Efficient handling of large data.
15. Interceptor and Event Listener: Customizing Hibernate behavior.
16. Integration with Spring Boot: Setting up Hibernate in a Spring Boot project.
17. Native SQL: Using native queries with Hibernate.
18. Validation: Bean validation using Hibernate Validator (javax.validation).
19. Migrating to JPA: Differences between Hibernate and JPA.
20. Performance Tuning: Tips for optimizing Hibernate applications.