• +91 9723535972
  • info@interviewmaterial.com

Hibernate Interview Questions and Answers

Question - What are the advantages of using Hibernate over JDBC?

Answer -

Major advantages of using Hibernate over JDBC are:

  • Hibernate eliminates a lot of boiler-plate code that comes with JDBC API, the code looks cleaner and readable.
  • This Java framework supports inheritance, associations, and collections. These features are actually not present in JDBC.
  • HQL (Hibernate Query Language) is more object-oriented and close to Java. But for JDBC, you need to write native SQL queries.
  • Hibernate implicitly provides transaction management whereas, in JDBC API, you need to write code for transaction management using commit and rollback.
  • JDBC throws SQLException that is a checked exception, so you have to write a lot of try-catch block code. Hibernate wraps JDBC exceptions and throw JDBCException or HibernateException which are the unchecked exceptions, so you don’t have to write code to handle it has built-in transaction management which helps in removing the usage of try-catch blocks.

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners