Post by – Subhash Bhajankar
What is the problem that hibernate is trying to solve?
Let’s take an example of simple class that you have in your application. Referring Image 1, we have Employee object in our java class which has six fields. In our running application We would have lots of such objects in memory, What if I restart my application ? Everything will be lost. So to overcome this problem and persist data inside my application i will save it in Database.
As shown in below image every object in Java will be represented as single row. Here, class corresponds to table and object of class corresponds to row. This was something that we were been doing over the year (Off course before ORM Tool).
Normal approach to save data in Java is something like :
- Create JDBC Connection
- Connect Database
- Create SQL String dynamically by taking fields value one by one
- And also manage all transaction, Exception handling, rollback and commit Continue reading “Introduction to Hibernate”