Hibernate Interview Questions

Hibernate Interview Questions

All below Hibernate Interview Questions are real time question which is covered by topic separately:

Topic 1: Basic ORM and Hibernate questions:

1. Please define ORM and benefits of ORM with Hibernate ?
2. What functionality ORM provides ?
3. Why we need ORM tools hibernate or why to choose hibernate as ORM tools?
4. Benefit using ORM tools?
5. What does ORM solution covers?
6. What do you mean by pure relational ORM?
7. What is Hibernate and what it simplifies?
8. Give me hibernate overview?
9. What are derived properties?
10. How can whole class mapped as immutable?
11. What is fetching strategy in hibernate?
12. What are POJOs classes?
13. What do you mean by attribute oriented programming?
14. Different methods of identifying object?
15. How will you represent inheritance hierarchy and how many ways you can do it?
16. Collection types in Hibernate?
17. Please define Hibernate proxy?
18. How many types of inheritance models available Hibernate?
19. Why we need no argument constructor in Hibernate Entities?
20. Could you make Hibernate Entity Class final?
21. Please show general flow of Hibernate communication with RDBMS?
22. Best practices for defining your Hibernate persistent classes?
23. What is hibernate associations and managed associations?
24. What are ORM levels ?


Topic 2: SessionFactory questions

1. What is SessionFactory?
2. Is SessionFactory thread safe object?
3. What is use of SessionFactory interface in Hibernate?
4. Where SessionFactory should keep so that it is easily accessible?
5. How you create create SessionFactory?

Topic 3: Session questions

1. What is Session in Hibernate?
2. Can single Session share among multiple threads Hibernate?
3. Difference between session.load() and session.get() method?
4. Difference between session.lock() and session.update() method?
5. How you re-attach detached objects to session when same object already been loaded into session?
6. What is Session interface?
7. What is Session lock() method?

Topic 4: Hibernate Query Language (HQL)

1. What is Hibernate Query Language (HQL)?
2. What is the use of HQL?
3. Give example of sample HQL statement
4. How many ways to express joins in HQL?

Topic 5: Configuration files questions

1. Most common methods configure Hibernate configuration?
2. What is use Hibernate xml mapping file and what we keep in this file?
3. What are main tags hibernate.cfg.xml file?
4. What we keep hibernate.properties file?
5. What is property file hibernate?
6. What is reference generation in hibernate

Topic 6: Difference related questions

1. Difference between ordered and sorted collection hibernate?
2. Difference between saveOrUpdate, save and persist methods hibernate?
3. Difference between detached, transient and persistent object Hibernate?
4. Difference between get() and load()?
5. Difference between update and merge?
6. Differences between Hibernate and EJB 3.0?
7. Difference between Hibernate and ibatis?

Topic 7: Interfaces questions

1. Core interfaces of Hibernate framework?
2. Extension interfaces of Hibernate framework?
3. What is a Callback interface?

Topic 8: SQL and Database related questions

1. To see Hibernate generated SQL statements on console what we do?
2. What is named SQL query Hibernate?
3. How invoke Stored Procedures hibernate?
4. How you configure sequence generated primary key which class you use in configuration file?
5. Draw general flow of Hibernate communication with RDBMS?
6. Advantage of Hibernate over JDBC?
7. What is dirty checking automatically?
8. What is Optimistic locking how you achieve it in Database?
10. What do you mean by transactional write behind?
11. What are ways to map Java Objects with Database tables?
12. How can we switch between relational databases without any code changes?

Topic 9: Mapping related questions

1. What is component mapping and how you do it in hibernate?
2. What file extension we use for hibernate mapping file?
3. What is light object mapping?
4. What is medium object mapping?
5. What is full object mapping?
6. What is cascade and inverse in one-to-many mapping?
7. How you configure dynamic insert and dynamic update attributes in hibernate class mapping?
8. What is object or relational mapping metadata in hibernate?
9. What are different types of property and class mappings?

Topic 10: Cache questions

1. What is Second level Cache?
2. What is query level cache?

Topic 11: Criteria API questions

1. What Criteria API?
2. How you use criteria API and which one faster plain SQL or Criteria API?
3. Give one example of select person name for table as criteria API?

Topic 12: Instance related questions

1. How can access instance variable without setter method?
2. How many types of Hibernate instance states available?
3. What is method chaining?

Topic 13: Configuration related questions

1. How you make configurable for different environments for example development, test and production?
2. How you configure Hibernate please tell me steps?

Topic 14: HibernateTemplate questions

1. What benefits HibernateTemplate provide?
2. What is HibernateTemplate?
3. How you use HibernateTemplate?

Topic 15: Detached object questions

1. What is use detached objects?
2. What are benefits and drawback of detached objects?
3. How hibernate distinguish between transient and detached objects?

Topic 16: Transaction management questions

1. How you manage transaction in hibernate?
2. How many ways you can manage transaction?
3. What is transaction using configuration?
4. What is transaction using annotation?
5. How do you handle transaction programmatically?
6. How you handle transaction in hibernate?

Leave a Reply

Your email address will not be published. Required fields are marked *