Hibernate Interview Questions Series Part 1

This is the Series of Hibernate Interview Questions mostly asked in freshers and experienced level
Series Oneof Hibernate Interview Questions

1.What is ORM ?
ORM stands for object/relational mapping. ORM is the automated persistence of objects
in a Java application to the tables in a relational database.

2.What does ORM consists of ?
An ORM solution consists of the followig four pieces:
· API for performing basic CRUD operations
· API to express queries refering to classes
· Facilities to specify metadata
· Optimization facilities : dirty checking,lazy associations fetching

3.What are the ORM levels ?
The ORM levels are:
· Pure relational (stored procedure.)
· Light objects mapping (JDBC)
· Medium object mapping
· Full object Mapping (composition,inheritance, polymorphism, persistence by
reachability)

4.What is Hibernate?
Hibernate 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.Its purpose is to relieve the developer from a significant amount of
relational data persistence-related programming tasks.

5.Why do you need ORM tools like hibernate?
The main advantage of ORM like hibernate is that it shields developers from messy SQL.
Apart from this, ORM provides following benefits:
· Improved productivity
o High-level object-oriented API
o Less Java code to write
o No SQL to write
· Improved performance
o Sophisticated caching
o Lazy loading

o Eager loading
· Improved maintainability
o A lot less code to write
· Improved portability
o ORM framework generates database-specific SQL for you

6.What Does Hibernate Simplify?
Hibernate simplifies:
· Saving and retrieving your domain objects
· Making database column and table name changes
· Centralizing pre save and post retrieve logic
· Complex joins for retrieving related items
· Schema creation from object model

7.What is the need for Hibernate xml mapping file?
Hibernate mapping file tells Hibernate which tables and columns to use to load and store
objects. Typical mapping file look as follows:

8.What are the most common methods of Hibernate configuration?
The most common methods of Hibernate configuration are:
· Programmatic configuration
· XML configuration (hibernate.cfg.xml)

9.What are the important tags of hibernate.cfg.xml?

Following are the important tags of hibernate.cfg.xml:

10.What are the Core interfaces are of Hibernate framework?
The five core interfaces are used in just about every Hibernate application. Using these
interfaces, you can store and retrieve persistent objects and control transactions.
· Session interface
· SessionFactory interface
· Configuration interface
· Transaction interface
· Query and Criteria interfaces

Hibernate Interview Questions Part 2

Leave a Comment