miliroom.blogg.se

Latest hibernate interview questions
Latest hibernate interview questions












That’s why Spring Hibernate combination is used a lot in enterprise applications. Spring is one of the most used Java EE Framework and Hibernate is the most popular ORM framework.

Latest hibernate interview questions code#

JDBC code is very tightly coupled with the application. Hibernate supports JPA annotations, so code is independent of implementation and easily replaceable with other ORM tools.This is very important feature in enterprise application and completely missing in JDBC API. Hibernate configuration helps us in using JDBC like connection as well as JNDI DataSource for connection pool.Hibernate provide option through which we can create database tables too, for JDBC tables must exist in the database.Hibernate supports caching that is better for performance, JDBC queries are not cached hence performance is low.For JDBC, we need to write native sql queries. Hibernate Query Language (HQL) is more object oriented and close to java programming language.Hibernate built-in transaction management removes the usage of try-catch blocks.

latest hibernate interview questions latest hibernate interview questions latest hibernate interview questions

Hibernate wraps JDBC exceptions and throw JDBCException or HibernateException un-checked exception, so we don’t need to write code to handle it. Most of the times it’s redundant in every JDBC call and used for transaction management.

  • JDBC API throws SQLException that is a checked exception, so we need to write a lot of try-catch block code.
  • Read more at JDBC Transaction Management. In JDBC API, we need to write code for transaction management using commit and rollback.
  • Hibernate implicitly provides transaction management, in fact most of the queries can’t be executed outside transaction.
  • These features are not present with JDBC API.
  • Hibernate supports inheritance, associations and collections.
  • Hibernate removes a lot of boiler-plate code that comes with JDBC API, the code looks cleaner and readable.
  • Some of the important advantages of Hibernate framework over JDBC are: What are the advantages of Hibernate over JDBC?
  • For database vendor specific feature, hibernate is suitable because we can also execute native sql queries.
  • Hibernate cache helps us in getting better performance.
  • Hibernate supports lazy initialization using proxy objects and perform actual database queries only when it’s required.
  • Hibernate is easy to integrate with other Java EE frameworks, it’s so popular that Spring Framework provides built-in support for integrating hibernate with Spring applications.
  • latest hibernate interview questions

    This makes it a better choice than others because learning curve is small and there are tons of online documentations and help is easily available in forums. Hibernate is an open source project from Red Hat Community and used worldwide.However, HQL is fully object-oriented and understands concepts like inheritance, polymorphism and association. Hibernate provides a powerful query language (HQL) that is similar to SQL.Hibernate framework provides support for XML as well as JPA annotations, that makes our code implementation independent.Hibernate eliminates all the boiler-plate code that comes with JDBC and takes care of managing resources, so we can focus on business logic.Some of the important benefits of using hibernate framework are:












    Latest hibernate interview questions