Important 10 Hibernate Interview Questions for fresherby Mayank K. mayankseo
1. Core Interface used in Hibernate Framework?
The core interfaces of Hibernate framework are:
2. What are the methods hibernate configuration?
We can use following two methods of hibernate configuration are:
- XML based configuration ( using hibernate.cfg.xml file)
- 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:
- Tables Per Concrete Class
- Table per class hierarchy
- 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:
- Join Fetching
- Batch Fetching
- Select Fetching
- 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:
- One-to-One Association
- Many-to-Many Association
Created on Dec 4th 2018 06:06. Viewed 419 times.