Articles

Important 10 Hibernate Interview Questions for fresher

by Mayank K. mayankseo

1. Core Interface used in Hibernate Framework?

The core interfaces of Hibernate framework are:

  • Configuration
  • SessionFactory
  • Session
  • Query
  • Criteria
  • Transaction

2. What are the methods hibernate configuration?

We can use following two methods of hibernate configuration are:

  1. XML based configuration ( using hibernate.cfg.xml file)
  2. Programmatic configuration ( Using code logic)

3. The advantages of using ORM over JDBC.

ORM has the following advantages over JDBC:

  • Application development is fast.
  • Management of transaction.
  • Generates key automatically.
  • Details of SQL queries are hidden.

4. What are the inheritance models of hibernate?

Hibernate has following three inheritance models:

  1. Tables Per Concrete Class
  2. Table per class hierarchy
  3. Table per sub-class

5. Difference between load() and get() method in hibernate?

Load() methods result in an exception if the required records aren’t found in the database while get() method returns null when records against the id aren’t found in the database.
So, ideally, we should use Load() method only when we are sure about the existence of records against an id.

6. What is fetching strategies in hibernate framework?

Following fetching strategies are available in hibernate framework:

  1. Join Fetching
  2. Batch Fetching
  3. Select Fetching
  4. Sub-select Fetching

7. Explain the role of JMX in hibernate framework?

Java Applications and components are managed in hibernate by a standard API called JMX API. JMX provides tools for the development of efficient and robust distributed, web-based solutions.

8. How to use bind hibernate session factory to JNDI?

Hibernate session factory can be bound to JNDI by making configuration changes in hibernate.cfg file.

9. How to create a Primary key using hibernate framework?

Database primary key is specified in the configuration file hbm.xml. A generator can also be used to specify how the primary key is being created in the database.

10. How used mapping associations in hibernate?

We have the following two types of mapping associations in hibernate:

  1. One-to-One Association
  2. Many-to-Many Association

Also more Read Online Interview Question

Sponsor Ads


About Mayank K. Advanced   mayankseo

177 connections, 2 recommendations, 400 honor points.
Joined APSense since, October 23rd, 2018, From DELHI, India.

Created on Dec 4th 2018 06:06. Viewed 419 times.

Comments

No comment, be the first to comment.
Please sign in before you comment.