By AmarSivas | | Updated : 2018-02-16 | Viewed : 405 times
Here we are going to discuss about Hibernate (ORM tool), architecture in brief and its main classes and interfaces.
Hibernate is an ORM, which is an Object Relational Mapping tool for java Programming Language. It provides a Framework to map an object oriented domain model with relation database table. Hibernate also can handle Object relational impedance mismatch. Hibernates primary feature is mapping from Java classes to database tables, and mapping from Java data types to SQL data types and vice versa. Hibernate also provides data query and retrieval facilities. It generates SQL calls and relieves the developer from the manual handling and object conversion of the result set. So the development time for application will be significantly reduced. Hibernate converts the data between Data access layer (Java) and Database. It will help us to remove Specific Database SQL.
Please find below given diagram visualized for Hibernate Architecture.
We will discuss here main interfaces of Hibernate. Please find the below given classes for the same.
A session factory is thread safe and very expensive also. So we have to create the only one Session Factory per one database. It will create multiple session instances, which will be used for executing the Database queries.
A Single threaded and short lived object which will used for executing a query. Here the session contains the JDBC connection object. So we need to session to execute every single database transaction. It will be behave factory for Transaction.
A single threaded, short lived object is Transaction. Each Database transaction, We need to create separate Transaction.
We Learned hibernate advantages over JDBC. We will discuss here hibernate first application in next chapter.