Java Persistence With Hibernate Part 1
Okay, first up on my list is Hibernate. I’ve used Hibernate with several projects already but since this is one of the two frameworks I will be teaching to my Java EE class, the other one is Spring MVC, I better read “Java Persistence With Hibernate 2nd Edition by Christian Bauer and Gavin King” and have a refresher about the basics. With this said, I will try to explain things as simple as possible but you are expected to have a working knowledge of Java and SQL.
Need for Object/Relational Persistence
Persistence in Computer Science basically means the existence of data even after an application or program has ended. This can be done through the use of a relational database such as MySQL or SQL Server with some stored procedures.
However, in creating applications we do not use relational databases by themselves (Imagine all of us creating queries and stored procedures just to save or retrieve data). We just integrate a database as a means to store data to our main application. Your application may be developed using Java or any other object-oriented language but this is where our problem starts.
Our application is an Object-Oriented language which is built around the idea of objects having states and behaviors while the database we are using is Relational which is all about tables. The problem is in translating those objects into a form that can be stored in a relational database.(Paradigm mismatch: Object Relational Mapping)
Another concern is that Java has a different syntax than SQL(the base language being used by relational databases). Well, Java has JDBC but is it enough? Do we just hard-code all of our SQL commands?
Lastly, different relational database management systems(RDBMS) uses different extensions of SQL, meaning they may have different syntax for several SQL commands. This poses a problem when you are trying to migrate from one RDBMS to another. Let’s say you used MySQL as your RDBMS for development and you had all your SQL commands hand-coded within your application. However, before deploying the application your client tells you that they would be using Oracle instead. You think that there’s no problem, since you used JDBC you just need to change some configurations regarding the driver used and migrate the MySQL tables to Oracle. But lo and behold when you deployed the application some part of it was not working. Most probably this is because some of your hand-coded MySQL commands have different syntax in Oracle.
Hibernate is an ambitious project that aims to be a complete solution to the problem of managing persistent data in Java. It mediates the application’s interaction with a relational database, leaving the developer free to concentrate on the business problem at hand. – from the book “Java Persistence With Hibernate”
There are other issues regarding Object Relational Mapping but I guess with the above explanation you already have a basic idea of the importance of Object/Relational persistence.
Java Persistence With Hibernate Part 2 – Getting Started

nosebleed, bab XD
magturo ka ng basic of the basic of the basic, para matuto naman kaming newbs XD
I will try to teach basic stuff after this or after my Spring MVC articles.