Hibernate framework for Java technology

Hibernate is a framework for Java technology, which is used to develop persistence layer of a Java based application.

Hibernate is a framework for Java technology, which is used to develop persistence layer of a Java based application. It is Object Relational Mapping (ORM) tool for mapping the relational object to the relational database. Hibernate is Java library which is used to develop the data access layer in Java based applications. It's very flexible and easier to use.

Hibernate  makes the development of dynamic web application much easier. You can develop easily write code for saving, updating, deleting and selecting the objects from database.

Hibernate is Java library which is released under the GNU Lesser General Public License. You can download the latest version of Hibernate framework from Hibernate Official website.

The latest version of Hibernate is Hibernate 4. You can read Hibernate 4 tutorial from our website and learn fast. We have tried to provide many articles, examples and code at our Hibernate 4 tutorial section.

If you are planning to make a career in Java programming language then you should learn Hibernate 4. These days most of the Java based application is using Hibernate to access the relational databases.

Hibernate Architecture Components:
  •     Connection Management
  •     Transaction management
  •     Object relational mapping

The above diagram shows that Hibernate is using the database and configuration data to provide persistence services (and persistent objects) to the application.

To use Hibernate, it is required to create Java classes that represents the table in the database and then map the instance variable in the class with the columns in the database. Then Hibernate can be used to perform operations on the database like select, insert, update and delete the records in the table. Hibernate automatically creates the query to perform these operations.

Hibernate architecture has three main components:
  •     Connection Management:
    Hibernate Connection management service provide efficient management of the database connections. Database connection is the most expensive part of interacting with the database as it requires a lot of resources of open and close the database connection. 
  •     Transaction management:
    Transaction management service provide the ability to the user to execute more than one database statements at a time.
  •     Object relational mapping:
    Object relational mapping is technique of mapping the data representation from an object model to a relational data model. This part of the hibernate is used to select, insert, update and delete the records form the underlying table. When we pass an object to a Session.save() method, Hibernate reads the state of the variables of that object and executes the necessary query.
Hibernate is very good tool as far as object relational mapping is concern, but in terms of connection management and transaction management, it is lacking in performance and capabilities. So usually hibernate is being used with other connection management and transaction management tools. For example apache DBCP is used for connection pooling with the Hibernate.

Hibernate provides a lot of flexibility in use. It is called "Lite" architecture when we only uses the object relational mapping component. While in "Full Cream" architecture all the three component Object Relational mapping, Connection Management and Transaction Management) are used.

Hibernate is a Object-relational mapping (ORM) tool for Java. It was initiated by Gavin King in 2001. ORM methodology is used to map classes to tables,  class  instances is mapped to rows and attributes are mapped to table columns. It also map data types of Java to SQL data types.

Hibernate is a persistence framework which used to store and fetch data from Java environment to database table. Persistence is a storing  process of data to permanent storing medium like SQL database and fetching back to any time which may be after ending the process which stores data to this table.

Advantages of using Hibernate
  •     It handles the mapping of Java class to the database table using annotation or XML file. You don't need to write any code to map it.
  •     Java objects can be store directly and fetch from the database using  it's easy APIs.
  •      Later on , if there is a change in any table or Database, you need to change only the XML file and the Java Class related to the table.
  •     You don't need to take care of SQL data type, you just need to work on familiar Java data types.
  •     It doesn't need any application server to function.
  •     Reduce database access complexity by with easy fetching techniques.
  •     It has easy and simple query for data access.
Supported Database

Hibernate supports following RDBMS :
  •     MySQL
  •     Oracle
  •     PostgreSQL
  •     FrontBase
  •     DB2/NT
  •     Microsoft SQL Server Database
  •     Sybase SQL Server
  •     Informix Dynamic Server
  •     HSQL Database Engine
Hibernate Architecture

The figure given below represents the architecture of Hibernate :









No comments:

Post a Comment