logo

Advantages of Hibernate in JAVA.

hibernate2

In this article, I am going to introduce concepts of hibernate framework with simplified examples. Hibernate was started in 2001 by Gavin King and it is an open source persistent framework.

Hibernate is based on ORM(Object-Relational Mapping).Hibernate is a powerful , high performance Object-Relational persistence and query service for java application. An ORM tool simplifies data creation, data manipulation and data access. Hibernate maps the java classes to database table and java data types to database data types. Hibernate sits between Java objects and database server to handle all the work for those objects that are based on ORM.

Advantages of hibernate

1.)    Hibernate maps the Java Classes to database table using an XML file.

2.)    If there is any change in database or in java classes then the only need to change in xml file .

3.)    Hibernate is an open source framework.

4.)    Hibernate provides simple queries of data.

5.)    Hibernate provides automatic table creation.

6.)    Fast performance

Downloading/Installing Hibernate

1.)    Download the latest version of hibernate from  http://www.hibernate.org/downloads.

2.)    Copy all jars from lib to in your CLASSPATH

How to create hibernate in Eclipse IDE

You need to follow these steps to create hibernate in eclipse IDE

1.)    Create a Java Project

2.)    Add Jars

3.)    Create the persistent java class

4.)    Create the mapping file for java class (an XML file)

5.)    Create Configuration File (an XML file)

6.)    Create an class that stores and retrieves the persistent objects

7.)    Finally run your application

Hibernate with Databases

For using Hibernate with database we need to configure in hibernate.cfg.xml our database by using some dialect property. These properties are as follows:-

Database                                                          Dialect Property

DB2                                                                        org.hibernate.dialect.DB2Dialect

HSQLDB                                                               org.hibernate.dialect.HSQLDialect

HypersonicSQL                                                   org.hibernate.dialect.HSQLDialect

Informix                                                               org.hibernate.dialect.InformixDialect

Ingres                                                                    org.hibernate.dialect.IngresDialect

Interbase                                                               org.hibernate.dialect.InterbaseDialect

Microsoft SQL Server 2000                              org.hibernate.dialect.SQLServerDialect

Microsoft SQL Server 2005                              org.hibernate.dialect.SQLServer2005Dialect

Microsoft SQL Server 2008                             org.hibernate.dialect.SQLServer2008Dialect

MySQL                                                                  org.hibernate.dialect.MySQLDialect

Oracle (any version)                                          org.hibernate.dialect.OracleDialect

Oracle 11g                                                            org.hibernate.dialect.Oracle10gDialect

Oracle 10g                                                            org.hibernate.dialect.Oracle10gDialect

Oracle 9i                                                               org.hibernate.dialect.Oracle9iDialect

PostgreSQL                                                          org.hibernate.dialect.PostgreSQLDialect

Progress                                                                org.hibernate.dialect.ProgressDialect

SAP DB                                                                 org.hibernate.dialect.SAPDBDialect

Sybase                                                                   org.hibernate.dialect.SybaseDialect

(To be Continue in next article)

PrintGoogle GmailFacebookBookmark/Favorites

2 Responses to “Advantages of Hibernate in JAVA.”

  1. Karina says:

    Wonderful posts! We will be linking to this particularly great post on our site. Keep up the good writing.

  2. Kristina says:

    I do not even know how I ended up here, but I thought all posts ware good. certainly you are going to a famous blogger 😉 Cheers!

Leave a Reply