Starting With Hibernate
1). Create a Dynamic Web project in Eclipse.
2). Copy the following jar files into project’s lib folder and project’s class path.
antlr-2.7.6.jar
asm.jar
asm-attrs.jar
cglib-2.1.3.jar
commons-collections-2.1.1.jar
commons-logging-1.1.jar
dom4j-1.6.1.jar
hibernate3.jar
javassist.jar
jta-1.1.jar
sqljdbc.jar (FOR MS SQL Server)
3). Create the Hibernate configuration file hibernate.cfg.xml as follows -
4). For example in above configuration we defined a hibernate mapping file status.hbm.xml which can look like -
5). Store all the configuration files in src/default package.
6). Create a HibernateUtil class for serving sessions utilizing sessionFactory as follows -
7). Create a DAO class
8). Create a java class for status.hbm.xml mapping as follows -
9) Now you are ready to use Hibernate using the above utility class HibernateUtil and the Hibernate configuration mappings.
Following is a sample program -





