{"id":79,"date":"2019-02-10T08:20:26","date_gmt":"2019-02-10T08:20:26","guid":{"rendered":"https:\/\/cybernite.in\/blog\/?p=79"},"modified":"2019-02-17T08:22:51","modified_gmt":"2019-02-17T08:22:51","slug":"advantages-of-hibernate-over-jdbc","status":"publish","type":"post","link":"https:\/\/cybernite.in\/blog\/advantages-of-hibernate-over-jdbc\/","title":{"rendered":"Advantages of hibernate over JDBC"},"content":{"rendered":"<p>Here is a list of advantages of hibernate over JDBC which will be helpful to you while choosing the backend preferences for your next java application.<\/p>\n<p><!--more--><br \/>\nHibernate removes a lot of boiler-plate code that comes with JDBC API, the code looks more cleaner and readable. Hibernate supports inheritance, associations and collections. These features are not present with JDBC API.<\/p>\n<p>Hibernate implicitly provides transaction management, in fact most of the queries can\u2019t be executed outside transaction. In JDBC API, we need to write code for transaction management using commit and rollback. Read more at JDBC Transaction Management.<br \/>\nJDBC API throws SQL Exception that is a checked exception, so we need to write a lot of try-catch block code. Most of the times it\u2019s redundant in every JDBC call and used for transaction management. Hibernate wraps JDBC exceptions and throw JDBC Exception or Hibernate Exception un-checked exception, so we don\u2019t need to write code to handle it. Hibernate built-in transaction management removes the usage of try-catch blocks.<\/p>\n<p>Hibernate Query Language (HQL) is more object oriented and close to java programming language. For JDBC, we need to write native sql queries. Hibernate supports caching that is better for performance, JDBC queries are not cached hence performance is low.<\/p>\n<p>Hibernate provide option through which we can create database tables too, for JDBC tables must exist in the database .Hibernate configuration helps us in using JDBC like connection as well as JNDI Data Source for connection pool. This is very important feature in enterprise application and completely missing in JDBC API.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is a list of advantages of hibernate over JDBC which will be helpful to you while choosing the backend preferences for your next java application.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17,15,18],"tags":[],"_links":{"self":[{"href":"https:\/\/cybernite.in\/blog\/wp-json\/wp\/v2\/posts\/79"}],"collection":[{"href":"https:\/\/cybernite.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cybernite.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cybernite.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cybernite.in\/blog\/wp-json\/wp\/v2\/comments?post=79"}],"version-history":[{"count":1,"href":"https:\/\/cybernite.in\/blog\/wp-json\/wp\/v2\/posts\/79\/revisions"}],"predecessor-version":[{"id":80,"href":"https:\/\/cybernite.in\/blog\/wp-json\/wp\/v2\/posts\/79\/revisions\/80"}],"wp:attachment":[{"href":"https:\/\/cybernite.in\/blog\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cybernite.in\/blog\/wp-json\/wp\/v2\/categories?post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cybernite.in\/blog\/wp-json\/wp\/v2\/tags?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}