Package com.isomorphic.hibernate
Interface HBProviderInterface
- All Known Implementing Classes:
HB6Provider
,SpringHB6Provider
public interface HBProviderInterface
Interface used to provide specific implementation of
Session
and transaction acquiring and handling.Implementation of this interface should provide at least two constructors:
- default constructor - will be used if implementation is used as default hibernate provider
- constructor with single parameter of type
Properties
- will be used if implementation is used as additional named hibernate provider
-
Method Summary
Modifier and TypeMethodDescriptionvoid
commitTransaction
(org.hibernate.Transaction tx) Commits specified transaction.org.hibernate.SessionFactory
get()
ReturnsSessionFactory
.org.hibernate.Session
ReturnsSession
for persistence operations.org.hibernate.Transaction
getTransaction
(org.hibernate.Session session) Returns started transaction.void
returnSession
(org.hibernate.Session session) ClosesSession
.void
rollbackTransaction
(org.hibernate.Transaction tx) Rolls back specified transaction.
-
Method Details
-
get
org.hibernate.SessionFactory get()ReturnsSessionFactory
.- Returns:
SessionFactory
.
-
getSession
org.hibernate.Session getSession() throws org.hibernate.HibernateExceptionReturnsSession
for persistence operations.- Returns:
Session
for persistence operations.- Throws:
org.hibernate.HibernateException
- if unable to acquireSession
.
-
returnSession
void returnSession(org.hibernate.Session session) ClosesSession
.- Parameters:
session
-Session
which should be closed.
-
getTransaction
org.hibernate.Transaction getTransaction(org.hibernate.Session session) throws org.hibernate.HibernateException Returns started transaction.- Parameters:
session
-Transaction
needed if joining to existing transaction or starting transaction locally.- Returns:
Transaction
Already started transaction for persistence operations.- Throws:
org.hibernate.HibernateException
- if unable to acquire or open transaction.
-
commitTransaction
void commitTransaction(org.hibernate.Transaction tx) throws org.hibernate.HibernateException Commits specified transaction.- Parameters:
tx
-Transaction
transaction to be committed.- Throws:
org.hibernate.HibernateException
- occurred while committing transaction.
-
rollbackTransaction
void rollbackTransaction(org.hibernate.Transaction tx) Rolls back specified transaction.- Parameters:
tx
-Transaction
transaction to be rolled back.
-