Hibernate Interview Questions and Answers are curated by Industry Experts.
1. What is Hibernate?
Hibernate refers to as a Java Framework. It enables the easy process of developing the Java application to interact with the original database.
Some Unique that Hibernate holds
- Hibernate is an Open-Source. Freely available to everyone across the world.
- Lightweight (installation & setup & queries)
- It is an Object Relational Mapping (ORM) tool.
2. What is ORM?
ORM stands for Object Relational Mapping Tool. It eases the process of data manipulation, data access, and data creation. ORM is a programming method that actually points the object to the database where data is actually stored.
3. How does the ORM tool access the database?
ORM internally uses the JDBC API to interact with the database.
4. Explain Architecture of Hibernate
Hibernate architecture is contains three layers as shown below
Hibernate is proficient in the existing Java API, with JDBC, Java Transaction API (JTA) and Java Naming and Directory Interface (JNDI).
1. Configuration Object
It is the first object in Hibernate using this you create in any Hibernate application. During the application initialization, it is created. Configuration Object represents a properties or configuration file required by the Hibernate.
The Configuration Object contains the following two keys components as mentioned belwo
It is handled through one or more configuration files that are supported by Hibernate. These files include
- i. hibernate.properties
- ii. hibernate.cfg.xml
2.Class Mapping Setup
It enables connection between database tables and Java Classes
5. What are the key Components of Hibernate?
List of key components are mentioned below
- Session Factory
6. What is HQL and How it is Created?
HQL is described as a Hibernate Query Language. It created using the following syntax mentioned below
7. How is SQL Query created in Hibernate?
SQL query in Hibernate created using the following syntax
8. What is SessionFactory?
Session Factory is called Factory of Session. It provides the instance of Session. Session Factory ensures to hold the data of next level cache that actually not enabled by default.