Hibernate interview questions are asked to the students because it is a widely used ORM tool. The important list of top hibernate interview questions and answers for freshers and Experience are given below.
Hibernate framework simplifies the development of java application to interact with the database. Hibernate is an open source, lightweight, ORM (Object Relational Mapping) tool.
ORM stands for object/relational mapping. ORM is the automated persistence of objects in a Java application to the tables in a relational database.
An ORM solution consists of the followig four pieces:
The ORM levels are:
The main advantage of ORM like hibernate is that it shields developers from messy SQL. Apart from this, ORM provides following benefits:
The core interfaces of Hibernate framework are:
The most common methods of Hibernate configuration are:
Yes, SessionFactory is a thread-safe object, many threads can access it simultaneously.
The application obtains Session instances from a SessionFactory. There is typically a single SessionFactory for the whole applicationå¹¼reated during application initialization. The SessionFactory caches generate SQL statements and other mapping metadata that Hibernate uses at runtime. It also holds cached data that has been read in one unit of work and may be reused in a future unit of work
SessionFactory sessionFactory = configuration.buildSessionFactory();
No, Session is not a thread-safe object, many threads can't access it simultaneously. In other words, you cannot share it between threads.,