|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openbp.server.persistence.BasicPersistenceContext
org.openbp.server.persistence.hibernate.HibernatePersistenceContext
public class HibernatePersistenceContext
The Hibernate persistence context represents a Hibernate session.
| Field Summary | |
|---|---|
protected org.hibernate.Session |
session
Underlying Hibernate session |
protected org.hibernate.SessionFactory |
sessionFactory
Hibernate session factory |
| Constructor Summary | |
|---|---|
HibernatePersistenceContext(org.hibernate.SessionFactory sessionFactory,
BasicPersistenceContextProvider provider)
Default constructor. |
|
| Method Summary | |
|---|---|
void |
deleteObject(java.lang.Object o)
Deletes an object from persistent storage. |
void |
doBeginTransaction()
|
void |
doCommitTransaction()
|
void |
doRollbackTransaction()
|
void |
evict(java.lang.Object obj)
Removes the given persistent object from the session cache. |
java.util.Iterator |
executeSelect(java.lang.String sql,
int maxResults)
Runs the given SQL select statement. |
int |
executeUpdateOrDelete(java.lang.String sql)
Runs the given SQL update or delete statement. |
java.lang.Object |
findById(java.lang.Object id,
java.lang.Class entityClass)
Finds an object by its primary key. |
void |
flush()
Forces the underlying persistence session to flush. |
org.hibernate.Session |
getHibernateSession()
Gets the underlying hibernate session object. |
java.lang.Object |
getObjectId(java.lang.Object obj)
Gets the primary key of the given object. |
boolean |
isPersistentObject(java.lang.Object obj)
Determines if the given class is managed by this persistence context. |
boolean |
isTransactionActive()
|
java.lang.Object |
merge(java.lang.Object obj)
Merges the (transient) given object with the current session and returns the persistent object. |
java.lang.Object |
refreshObject(java.lang.Object obj)
Refreshes the given persistent object. |
void |
release()
Releases the context. |
java.util.Iterator |
runQuery(PersistenceQuery query)
Returns a list of the objects of a particular type that match the given criterion. |
java.lang.Object |
saveObject(java.lang.Object o)
Saves the given object to the persistent storage. |
| Methods inherited from class org.openbp.server.persistence.BasicPersistenceContext |
|---|
beginTransaction, commitTransaction, createEntity, createLoggedException, createQuery, determineEntityClass, getPersistenceContextProvider, isTransactional, rollbackTransaction, setPersistenceContextProvider, setTransactional, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final org.hibernate.SessionFactory sessionFactory
protected org.hibernate.Session session
| Constructor Detail |
|---|
public HibernatePersistenceContext(org.hibernate.SessionFactory sessionFactory,
BasicPersistenceContextProvider provider)
sessionFactory - Hibernate session factory objectprovider - Persistence context provider| Method Detail |
|---|
public void release()
release in interface PersistenceContextrelease in class BasicPersistenceContextpublic boolean isPersistentObject(java.lang.Object obj)
obj - Object to check (usually an object implementing PeristentObject)
public java.lang.Object getObjectId(java.lang.Object obj)
throws PersistenceException
obj - The object
PersistenceException - On error
public java.lang.Object merge(java.lang.Object obj)
throws PersistenceException
obj - Object to refresh
PersistenceException - On error
public java.lang.Object refreshObject(java.lang.Object obj)
throws PersistenceException
obj - Object to refresh
PersistenceException - On error
public void evict(java.lang.Object obj)
throws PersistenceException
obj - Object to evict
PersistenceException - On error
public java.lang.Object findById(java.lang.Object id,
java.lang.Class entityClass)
throws PersistenceException
id - Primary keyentityClass - Type of object to lookup (usually a class implementing PeristentObject)
PersistenceException - On error
public java.util.Iterator runQuery(PersistenceQuery query)
throws PersistenceException
query - Query to run
PersistenceException - On error
public java.lang.Object saveObject(java.lang.Object o)
throws PersistenceException
o - Object to insert or update
PersistenceException - On error
public void deleteObject(java.lang.Object o)
throws PersistenceException
o - Object to delete
PersistenceException - On error
public int executeUpdateOrDelete(java.lang.String sql)
throws PersistenceException
sql - An SQL update statement
PersistenceException - On error
public java.util.Iterator executeSelect(java.lang.String sql,
int maxResults)
throws PersistenceException
sql - SQL query to runmaxResults - Maximum number of result rows or 0 for unlimited
PersistenceException - On error
public boolean isTransactionActive()
throws PersistenceException
PersistenceException
public void doBeginTransaction()
throws PersistenceException
PersistenceException
public void doRollbackTransaction()
throws PersistenceException
PersistenceException
public void doCommitTransaction()
throws PersistenceException
PersistenceException
public void flush()
throws PersistenceException
PersistenceException - On error performing the operations on the persistent storagepublic org.hibernate.Session getHibernateSession()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||