- What is Hibernate?
Hibernate is an open-source Object-Relational Mapping (ORM) framework that simplifies database operations in Java applications.
- What are the benefits of using Hibernate?
Hibernate eliminates the need for boilerplate JDBC code, improves performance, supports caching, and provides a consistent object model.
- What are the different types of mappings in Hibernate?
Hibernate supports three types of mappings: one-to-one, one-to-many, and many-to-many.
- What is the difference between Hibernate and JDBC?
Hibernate is a high-level ORM framework that abstracts away database-specific details, while JDBC is a low-level API for executing SQL statements.
- What is an Entity in Hibernate?
An Entity in Hibernate represents a persistent object, which is stored in a database and can be retrieved and modified later.
- What is a SessionFactory in Hibernate?
A SessionFactory in Hibernate is a thread-safe factory for creating Hibernate Sessions, which are used to interact with the database.
- What is a Hibernate configuration file?
A Hibernate configuration file contains information about the database connection, mapping files, and other Hibernate settings.
- What is lazy loading in Hibernate?
Lazy loading in Hibernate delays the loading of associated objects until they are actually needed, improving performance and reducing memory usage.
- What is the purpose of a Hibernate Session?
A Hibernate Session is used to perform database operations such as inserting, updating, and deleting objects, and querying the database.
- What is a Criteria API in Hibernate?
The Criteria API in Hibernate provides a type-safe and object-oriented way to construct SQL queries dynamically.
- What is a Hibernate Transaction?
A Hibernate Transaction represents a single atomic unit of work with the database, which must be completed successfully or rolled back if an error occurs.
- What is the purpose of Hibernate caching?
Hibernate caching reduces the number of database queries by storing frequently accessed data in memory, improving performance and scalability.
- What is a Hibernate Query Language (HQL)?
Hibernate Query Language (HQL) is a high-level object-oriented query language that allows developers to write database queries using object-oriented syntax.
- What is a Second-Level Cache in Hibernate?
A Second-Level Cache in Hibernate is a cache shared across all Sessions in an application, which can improve performance by reducing the number of database queries.
- What is a Hibernate Validator?
Hibernate Validator is a framework that provides a set of annotations and classes for validating objects, ensuring that they meet specific constraints.
- What is a Proxy object in Hibernate?
A Proxy object in Hibernate is a lightweight placeholder for an Entity, which is loaded from the database only when its properties are accessed.
- What is a Hibernate interceptor?
A Hibernate interceptor is an object that can intercept and modify SQL statements generated by Hibernate, allowing developers to customize Hibernate behavior.
- What is the difference between Hibernate and JPA?
JPA is a Java specification for ORM frameworks, while Hibernate is a popular implementation of that specification.
- What are the different ways of mapping Inheritance in Hibernate?
Hibernate supports three ways of mapping Inheritance: Single Table, Joined Table, and Table Per Class.
- What is the difference between FetchType.LAZY and FetchType.EAGER?
FetchType.LAZY loads associated objects only when they are actually needed, while FetchType.EAGER loads them immediately along with the parent object.