Monday 26 November 2012

Hibernate

Introduction:-


Hibernate is a free tool used in Java programming that allows data to be  inserted, removed or changed in a  database without paying a lot of attention to how it gets there. So SQL is used—Hibernate does that.


Hibernate was founded by Mr. Gavin King, an Australian developer who needed to solve a problem and ended up creating Hibernate, an open source tool that is amazingly useful. 


When Can I Use Hibernate: 


  • Hibernate can be used in any Java program that needs to access a relational database. 
  • Hibernate does not need an application server to run in. 
  • Hibernate can be used in any Java class with really no other dependencies other than on a single Hibernate JAR file and one configuration file.

When Should I Use Hibernate:


According to The Man himself [Gavin King], you should only consider using Hibernate if:
  • You have a non-trivial application. 
  • You have more than 10 tables in your relational DB. 
  • Your application uses an object-oriented Domain Model.
  • If your application does a lot of business logic—and does much more than just display tables of data on a webpage—then it is a good candidate for Hibernate.
  • Hibernate is best in applications with complex data models, with hundreds of tables and complex inter-relationships. 
  • In a normal JDBC application, you deal with populating a List of POJOs with data you manually pulled from a ResultSet.

How Hibernate Works:



  • Hibernate does not force you to change your POJOs.
  • Hibernate does not force you to implement any interface.
  • Hibernate works on any POJO.
  • Hibernate requires 1 overall configuration file.
  • That 1 configuration file tells Hibernate
  • à Which classes you want to store in the database.
  • Each mapped class needs an additional configuration file.
  • à How each class relates to the tables and columns
  •      in the database.

No comments:

Post a Comment