Hibernate Basics
By Ramakrishna on Sep 20, 2008 in Hibernate Tutorial
Introduction
Hibernate is a solution for object relational mapping and a persistence management solution or persistent layer. This is probably not understandable for anybody learning Hibernate.
What you can imagine is probably that you have your application with some functions (business logic) and you want to save data in a database. When you use Java all the business logic normally works with objects of different class types. Your database tables are not at all objects.
Hibernate provides a solution to map database tables to a class. It copies one row of the database data to a class. In the other direction it supports to save objects to the database. In this process the object is transformed to one or more tables.
Saving data to a storage is called persistence. And the copying of tables to objects and vice versa is called object relational mapping.
Create a Java Project
Using Eclipse press the keys Ctrl+n (Strg+n) to create a new project. Select a Java project. We will call it FirstHibernateExample.
Prepare the project for Hibernate using
MyEclipse
When you are using MyEclipse, right click on your project in the package explorer and choose Add Hibernate capabilities.
Select First Hibernate Program—>In that select New–>and then Just follow the instructions
Continue the wizard and create a new hibernate.cfg.xml in the src directory.
In the last step you can create a Hibernate SessionFactory. I prefer to create my own. You can find it below.
