Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Hibernate Interview Questions and Answers

Test your skills through the online practice test: Hibernate Quiz Online Practice Test

Related differences

Ques 1. What is Hibernate?

Synonym of Hibernate is Winter.  It means Spend the winter in a dormant state.
As a technology Hibernate is a open source, free Java package that makes it easy to work with relational databases. It is a pure Java object-relational mapping (ORM) and persistence framework that allows you to map plain old Java objects to relational database tables using (XML) configuration files or using annotations. Its purpose is to relieve the developer from a significant amount of relational data persistence-related programming tasks.

Is it helpful? Add Comment View Comments
 

Ques 2. What is ORM?

ORM stands for Object/Relational mapping. It is the programmed and mapping of objects in a Java application in to the tables of a relational database using the metadata that describes the mapping between the objects and the database. It works by transforming the data from one representation to another.

We are familiar with Model/Pojo class and Relational Database. Here Object means Model/Pojo class and Relational means the databases. By hbm.xml file or through annotations we represent the mapping between Object and Relational databases.

Is it helpful? Add Comment View Comments
 

Ques 3. What does an ORM solution comprises of?

Hibernate should have an language or API for performing basic CRUD (Create, Read, Update, Delete) operations on objects of persistent classes where persistent means POJO classes that you create that represent the table in database to keep the state of object alive. 

It should have a language or an API for specifying queries that refer to the classes and the properties of classes an ability for specifying mapping metadata. 
It should have a technique for ORM implementation to interact with transactional objects to perform lazy association fetching, dirty checking, and other optimization functions.

Is it helpful? Add Comment View Comments
 

Ques 4. What are the different levels of ORM quality?

Four levels defined for ORM quality:

  • Pure relational 
  • Light object mapping 
  • Medium object mapping 
  • Full object mapping
Pure relational:
The entire application, including the user interface, designed around the relational model and SQL based relational operations.
Light object mapping :
The entities are represented as classes that are mapped manually to the relational tables. The code is hidden from the business logic using specific design patterns. This approach is successful for applications with a less number of entities, or applications with common, metadata-driven data models.
Medium object mapping:
The application is designed around an object model. The SQL code is generated at build time. And the associations between objects are supported by the persistence mechanism, and queries are specified using an object-oriented expression language. This is best suited for medium-sized applications with some complex transactions. 
Full object mapping:
Full object mapping supports sophisticated object modeling: inheritance, polymorphism, composition and persistence. The persistence layer implements transparent persistence. Persistent classes do not inherit any special base class or have to implement a special interface. Efficient fetching strategies and caching strategies are implemented transparently to the application.

Is it helpful? Add Comment View Comments
 

Ques 5. What is a pure relational ORM?

The entire application including the user interface is designed around the relational model and SQL based relational operations where Model and Database will be mapped through hbm.xml configuration files or annotations and can execute SQL operations using Model Objects.

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

©2024 WithoutBook
Hibernate 3 vs Hibernate 4JDBC vs HibernateJPA vs Hibernate