Monday, 2 November 2015

Core interfaces of Hibernate framework

1. Session Interface (org.hibernate.Session): It is a single-threaded, short-lived object which allows you to create query objects to retrieve persistent objects.
It wraps JDBC java.sql.Connection and works as a factory for org.hibernate.Transaction.

2. SessionFactory interface (org.hibernate.SessionFactory):
SessionFactory is an immutable thread-safe cache of compiled mappings for a single database. We generally initialize SessionFactory once and cache it to reuse in application (shared by all the application threads).

The delivery of session objects to hibernate applications is done by this interface.

3. Configuration Interface (org.hibernate.cfg.Configuration): This interface is used to configure and bootstrap hibernate. The instance of this interface is used by the application in order to specify the location of hibernate specific mapping documents.

4. Transaction Interface (org.hibernate.Transaction):Transaction is a single-threaded, short-lived object used by the application to specify atomic units of work. 

It abstracts the application from the underlying JDBC or JTA transaction. A org.hibernate.Session might span multiple org.hibernate.Transaction in some cases.

5. Query and Criteria interface: The queries from the user are allowed by this interface apart from controlling the flow of the query execution.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...