What is Hibernate – Hibernate Introduction
In this tutorial am going to explain, why Hibernate came into picture though we have JDBC for connecting to the database, and what is this hibernate frame work first let us see what are the draw backs of JDBC
Draw Backs of JDBC:
- In JDBC, if we open a database connection we need to write in try, and if any exceptions occurred catch block will takers about it, and finally used to close the connections.
- here as a programmer we must close the connection, or we may get a chance to get our of connections message…!
- Actually if we didn’t close the connection in the finally block, then jdbc doesn’t responsible to close that connection.
- In JDBC we need to write Sql commands in various places, after the program has created if the table structure is modified then the JDBC program doesn’t work, again we need to modify and compile and re-deploy required, which is tedious.
- JDBC used to generate database related error codes if an exception will occurs, but java programmers are unknown about this error codes right.
- In the Enterprise applications, the data flow with in an application from class to class will be in the form of objects, but while storing data finally in a database using JDBC then that object will be converted into text. Because JDBC doesn’t transfer objects directly.
In order to overcome above problems, Hibernate came into picture..!
What is Hibernate:
Hibernate is the ORM tool given to transfer the data between a java (object) application and a database (Relational) in the form of the objects. Hibernate is the open source light weight tool given by Gavin King, actually JBoss server is also created by this person only.
Hibernate is a non-invasive framework, means it wont forces the programmers to extend/implement any class/interface, and in hibernate we have all POJO classes so its light weight.
Hibernate can runs with in or with out server, i mean it will suitable for all types of java applications (stand alone or desktop or any servlets bla bla.)
Hibernate is purely for persistence (to store/retrieve data from Database).
Sivateja Kandula ♦ ( Java/J2EE Developer & Web Designer )
Founder of Java4s.com. You can contact me at sivateja [at] java4s.com