Advantages of Hibernate Framework

Advantages of  Hibernate Framework :

  • Hibernate has capability to generate primary keys automatically while storing the records into database.
  • Hibernate provide automatic table creation facility.
  • Hibernate framework supports Inheritance, Associations, Collections.
  • Hibernate has annotations facilities.
  • In hibernate if you save the subclass class object, then its super class object will also be stored into the database, that is hibernate supporting inheritance.
  • Hibernate provide caching technique through this, an application can increase its performance automatically.
  • Hibernate supports relationships such as One-To-Many,One-To-One, Many-To-Many-to-Many, Many-To-One
    it is also supports collections like list, set, map, bag.
  • In hibernate you only have Un-checked(Runtime) exceptions, so don’t need to write try-catch block, or throws. Because in hibernate has translator which converts checked to Un-checked.
  • Hibernate has its own query language, that is hibernate query language(HQL) which is database independent.┬áSo that if you will change the database, then your application will works properly due to HQL is database independent.
  • Pagination can use in hibernate is very simple.
  • Hibernate provides Dialect classes, so you don’t need to write sql specific queries in hibernate, instead use the methods provided by API.

What is stored procedure and how to create?

Sotred Procedure :

Stored procedure is a subroutine or a segment of declarative sql statement stored inside the database server. each stored procedure contains a body that consists of an sql statement. This statement can be a compound statements made up of several statements separated by semicolon (;) characters.
Stored procedure has a body made up of a BEGIN … END block.

delimiter $$
create procedure myprocedure()
select * from employee;
end $$


Advantage of stored procedure :

  • It increase application performance. Once created compiled and stored in the database server.
  • It reduce traffic between application and database.
  • It is secure because it stored on database server.
  • It is reusable and transparent to any application which want to use it.