Hibernate General Interview Questions
  1. What are the advantages of Hibernate over JDBC?
  2. What are some of the important interfaces of Hibernate framework?
  3. What is a Session in Hibernate?
  4. What is a SessionFactory?
  5. What do you think about the statement - “session being a thread-safe object”?
  6. Can you explain what is lazy loading in hibernate?
  7. What can you tell about Hibernate Configuration File?
  8. How do you create an immutable class in hibernate?
  9. Can you explain the concept behind Hibernate Inheritance Mapping?
  10. Is hibernate prone to SQL injection attack?
  11. Explain hibernate mapping file
  12. What are the most commonly used annotations available to support hibernate mapping?
  13. Explain Hibernate architecture
  14. What is criteria API in hibernate?
  15. What is HQL?
  16. What does session.lock() method in hibernate do?
  17. When is merge() method of the hibernate session useful?
  18. Collection mapping can be done using One-to-One and Many-to-One Associations. What do you think?
  19. Can you tell the difference between setMaxResults() and setFetchSize() of Query?
  20. Does Hibernate support Native SQL Queries?
  21. What is the difference between first level cache and second level cache?
  22. Can you tell the difference between getCurrentSession and openSession methods?
  23. Differentiate between save() and saveOrUpdate() methods in hibernate session.
  24. Differentiate between get() and load() in Hibernate session
  25. List some of the databases supported by Hibernate.
Hibernate Advanced Interview Questions
  1. What happens when the no-args constructor is absent in the Entity bean?
  2. Can we declare the Entity class final?
  3. What are the states of a persistent entity?
  4. Explain Query Cache
  5. Can you tell something about the N+1 SELECT problem in Hibernate?
  6. How to solve N+1 SELECT problem in Hibernate?
  7. What are the concurrency strategies available in hibernate?
  8. What is Single Table Strategy?
  9. Can you tell something about Named SQL Query
  10. What are the benefits of NamedQuery?
  11. How to complete a transaction in Hibernate?
  12. Can you touch upon the different types of relationships available in Hibernate mapping?
  13. What is the purpose of Session.beginTransaction()?
  14. Where is object/relational mappings defined in Hibernate?
  15. What is lazy loading?
  16. What are the ways to express joins in HQL?
  17. How would you define automatic dirty checking?
  18. Explain the different ways Hibernate manages concurrency?
  19. Can you detail out the various collection types in Hibernate?
  20. Explain the difference between hibernate and Spring?
  21. What is meant by Hibernate tuning?
  22. What is Transaction Management in Hibernate? How does it work?
  23. How do you integrate Hibernate with Struts2 or Servlet web applications?
  24. What are the different states of a persistent entity?
  25. How can the primary key be created by using Hibernate?
  26. Explain about Hibernate Proxy and how it helps in Lazy loading?
  27. How can we see Hibernate generated SQL on console?
  28. What is Query Cache in Hibernate?
  29. What is the benefit of Native SQL query support in Hibernate?
  30. What is Named SQL Query?
  31. When do you use merge() and update() in Hibernate?
  32. Difference between get() vs load() method in Hibernate?
  33. Difference between the first and second level cache in Hibernate?
  34. Difference between Session and SessionFactory in Hibernate?
  35. Difference between save() and saveOrUpdate() method of Hibernate?
  36. Difference between sorted and ordered collection in Hibernate?
  37. Difference between the transient, persistent and detached state in Hibernate?
  38. Difference between managed associations and Hibernate associations?
  39. What are the best practices that Hibernate recommends for persistent classes?
  40. What are the best practices to follow with Hibernate framework?
  41. How do we create session factory in hibernate?
  42. What is criteria API?
  43. How can we get hibernate statistics?
  44. What are the advantages of Hibernate?
  45. What is “persistence”?
  46. Name some databases that Hibernate supports.
  47. What design patterns does the Hibernate framework use?
  48. Name the states that a persistent entity exists in.
  49. How many ways can an object be fetched from Hibernate’s database?
  50. How many ways can you disable Hibernate’s second-level cache?
  51. How to create database applications in Java with the use of Hibernate?
  52. Can you explain the "version field"?
  53. What are your views on the function addClass?
  54. Can you explain the role of addDirectory() and addjar() methods?
  55. What are your thoughts on file mapping in Hibernate?
  56. File mapping is the core function of Hibernate. It is a prime tool in database mapping. Typically, the mapping takes place between attributes and classes. Application of tags, after mapping the files in a database, can indicate the primary key.
  57. Can you share your views on mapping description files?
  58. What is a polymorphic association?
  59. What is the difference between load and get method in hibernate?
  60. Is hibernate Sessionfactory Singleton?
  61. What is the use of dialect in hibernate?
  62. What is the use of Show_sql in hibernate?
  63. Is Sessionfactory immutable?
  64. Is Hibernate configuration file mandatory?
  65. What is meant by annotation in hibernate?
  66. What does hibernate.hbm2ddl.auto create means?
  67. What is the use of projection in hibernate?
  68. Can I disable first level cache in hibernate?
  69. What is the use of bag in hibernate?
  70. What is the use of Mappedby in hibernate?
  71. What is inverse true in hibernate?
  72. What is a bidirectional relationship?
  73. What is JMX in Hybernate?
  74. How to bind hibernate session factory to JNDI?
  75. What are the fetching strategies in hibernate?
  76. What are derived properties in hibernate?
  77. What is version property in hibernate?
  78. What does session lock () method do in hibernate?
  79. What does evict do in hibernate?
  80. What is table per concrete class in hibernate?
  81. What is light object mapping in hibernate?