Hibernate Overview


Hibernate is an Object-Relational Mapping(ORM) solution for JAVA and it raised as an open source persistent framework created by Gavin King in 2001. It is a powerful, high performance Object-Relational Persistence and Query service for any Java Application.

Hibernate maps Java classes to database tables and from Java data types to SQL data types and relieve the developer from 95% of common data persistence related programming tasks.

Hibernate sits between traditional Java objects and database server to handle all the work in persisting those objects based on the appropriate O/R mechanisms and patterns.




Hibernate Advantages:

Hibernate takes care of mapping Java classes to database tables using XML files and without writing any line of code.

Provides simple APIs for storing and retrieving Java objects directly to and from the database.

If there is change in Database or in any table then the only need to change XML file properties.

Abstract away the unfamiliar SQL types and provide us to work around familiar Java Objects.

Hibernate does not require an application server to operate.

Manipulates Complex associations of objects of your database.

Minimize database access with smart fetching strategies.

Provides Simple querying of data.
Supported Databases:

Hibernate supports almost all the major RDBMS. Following is list of few of the database engines supported by Hibernate.

HSQL Database Engine

DB2/NT

MySQL

PostgreSQL

FrontBase

Oracle

Microsoft SQL Server Database

Sybase SQL Server

Informix Dynamic Server
Supported Technologies:

Hibernate supports a variety of other technologies, including the following:

XDoclet Spring

J2EE

Eclipse plug-ins

Maven
Hibernate Architecture







o 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.


Comments

  1. Nice tutorial for hibernate.
    You can also check:

    https://wingsofm.blogspot.in/2017/05/hiernate-overview-hibernate-is-object.html

    ReplyDelete

Post a Comment

Popular Posts