Some Basic APIs in Hibernate

By: Felix Emailed: 1646 times Printed: 2111 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

Here are quick discussions about some of the API objects in Hibernate.

SessionFactory (org.hibernate.SessionFactory)
A thread-safe, immutable cache of compiled mappings for a single database. A factory for org.hibernate.Session instances. A client of org.hibernate.connection.ConnectionProvider. Optionally maintains a second level cache of data that is reusable between transactions at a process or cluster level.

Session (org.hibernate.Session)
A single-threaded, short-lived object representing a conversation between the application and the persistent store. Wraps a JDBC java.sql.Connection. Factory for org.hibernate.Transaction. Maintains a first level cache of persistent the application's persistent objects and collections; this cache is used when navigating the object graph or looking up objects by identifier.

Persistent objects and collections
Short-lived, single threaded objects containing persistent state and business function. These can be ordinary JavaBeans/POJOs. They are associated with exactly one org.hibernate.Session. Once the org.hibernate.Session is closed, they will be detached and free to use in any application layer (for example, directly as data transfer objects to and from presentation). 

Transient and detached objects and collections
Instances of persistent classes that are not currently associated with a org.hibernate.Session. They may have been instantiated by the application and not yet persisted, or they may have been instantiated by a closed org.hibernate.Session. 

Transaction (org.hibernate.Transaction)
(Optional) A single-threaded, short-lived object used by the application to specify atomic units of work. It abstracts the application from the underlying JDBC, JTA or CORBA transaction. A org.hibernate.Session might span several org.hibernate.Transactions in some cases. However, transaction demarcation, either using the underlying API or org.hibernate.Transaction, is never optional.

ConnectionProvider (org.hibernate.connection.ConnectionProvider)
(Optional) A factory for, and pool of, JDBC connections. It abstracts the application from underlying javax.sql.DataSource or java.sql.DriverManager. It is not exposed to application, but it can be extended and/or implemented by the developer.

TransactionFactory (org.hibernate.TransactionFactory)
(Optional) A factory for org.hibernate.Transaction instances. It is not exposed to the application, but it can be extended and/or implemented by the developer.

Extension Interfaces
Hibernate offers a range of optional extension interfaces you can implement to customize the behavior of your persistence layer. See the API documentation for details.


Hibernate Home | All Hibernate Tutorials | Latest Hibernate Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Felix
Hibernate JDBC and Connection Properties
Hibernate Transaction Properties
Hibernate Cache Properties
Hibernate Configuration Properties
Creating Connection Pool for JDBC Connections in Hibernate
SessionFactory in Hibernate
Programmatic configuration in Hibernate
Contextual sessions in Hibernate
Some Basic APIs in Hibernate
A sample Hibernate Web Application using Servlets
Step by Step Hibernate - Your First Hibernate Application
Tutorial Using the Java Persistence API (JPA) in Hibernate
Download Hibernate latest version

More Tutorials in Hibernate
Fetching strategies in Hibernate
equals() and hashCode() in Hibernate
Tuplizers (org.hibernate.tuple.Tuplizer) in Hibernate
EntityNameResolvers in Hibernate
Hi/lo algorithm in Hibernate
Identity columns and sequences in Hibernate
Assigned identifiers in Hibernate
Primary keys assigned by triggers in Hibernate
Formula in Hibernate
Step by Step Hibernate - Your First Hibernate Application
A sample Hibernate Web Application using Servlets
Some Basic APIs in Hibernate
Contextual sessions in Hibernate
Programmatic configuration in Hibernate
SessionFactory in Hibernate

More Latest News
Most Viewed Articles (in Hibernate )
Hibernate Vs. JDBC ( A comparison)
A sample Hibernate Web Application using Servlets
Download Hibernate latest version
Step by Step Hibernate - Your First Hibernate Application
Fetching strategies in Hibernate
What is component mapping in hibernate?
Hibernate JDBC and Connection Properties
EntityNameResolvers in Hibernate
Hi/lo algorithm in Hibernate
Primary keys assigned by triggers in Hibernate
Formula in Hibernate
Types of inheritence models in Hibernate
Creating Connection Pool for JDBC Connections in Hibernate
Hibernate Configuration Properties
Assigned identifiers in Hibernate
Most Emailed Articles (in Hibernate)
Delta Electronics Chairman Bruce Cheng Endows NCKU Build Y.S. Sun Green Building Research Center
Paging Through the Result Set in Hibernate
SessionFactory in Hibernate
Hibernate Configuration Properties
Hibernate JDBC and Connection Properties
Assigned identifiers in Hibernate
Types of inheritence models in Hibernate
What is component mapping in hibernate?
Download Hibernate latest version
Some Basic APIs in Hibernate
Contextual sessions in Hibernate
A sample Hibernate Web Application using Servlets
Programmatic configuration in Hibernate
Fetching strategies in Hibernate
equals() and hashCode() in Hibernate