public class YPersistenceManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DB_DELETE |
static int |
DB_INSERT |
static int |
DB_UPDATE |
protected static org.hibernate.SessionFactory |
factory |
Constructor and Description |
---|
YPersistenceManager()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
closeFactory() |
void |
closeSession() |
void |
commit() |
org.hibernate.Query |
createQuery(java.lang.String queryString) |
protected void |
deleteObject(java.lang.Object obj)
Causes the supplied object to be removed from the persistence cache when the
current transaction is committed.
|
void |
deleteObjectFromExternal(java.lang.Object obj)
Causes the supplied object to be unpersisted when the current transaction is committed.
|
java.util.List |
execQuery(org.hibernate.Query query)
executes a Query object based on the sql string passed
|
java.util.List |
execQuery(java.lang.String queryString) |
org.hibernate.SessionFactory |
getFactory() |
java.util.List |
getObjectsForClass(java.lang.String className)
returns all the instances currently persisted for the class passed
|
java.util.List |
getObjectsForClassWhere(java.lang.String className,
java.lang.String whereClause)
returns all the instances currently persisted for the class passed that
match the condition specified in the where clause
|
org.hibernate.Session |
getSession() |
java.lang.String |
getStatistics() |
org.hibernate.Transaction |
getTransaction() |
protected org.hibernate.SessionFactory |
initialise(boolean journalising) |
boolean |
isEnabled() |
boolean |
isRestoring() |
boolean |
isStatisticsEnabled() |
protected void |
rollbackTransaction()
Forces a rollback of the current transaction,
|
java.lang.Object |
selectScalar(java.lang.String className,
java.lang.String field,
long value)
same as above but takes a long value instead
|
java.lang.Object |
selectScalar(java.lang.String className,
java.lang.String field,
java.lang.String value)
gets a scalar value (as an object) based on the values passed
|
void |
setEnabled(boolean enable) |
protected void |
setRestoring(boolean restoring) |
void |
setStatisticsEnabled(boolean enabled) |
boolean |
startTransaction()
Start a new Hibernate transaction.
|
protected void |
storeObject(java.lang.Object obj)
Persists an object.
|
void |
storeObjectFromExternal(java.lang.Object obj)
Causes the supplied object to be persisted when the current transaction is committed.
|
protected void |
updateObject(java.lang.Object obj)
Causes the supplied object to be updated when the current transaction is committed.
|
void |
updateObjectExternal(java.lang.Object obj)
Causes the supplied object to be updated within the persistence cache when the
current transaction is committed.
|
public static final int DB_UPDATE
public static final int DB_DELETE
public static final int DB_INSERT
protected static org.hibernate.SessionFactory factory
protected org.hibernate.SessionFactory initialise(boolean journalising) throws YPersistenceException
YPersistenceException
public void setEnabled(boolean enable)
public boolean isEnabled()
public org.hibernate.SessionFactory getFactory()
public boolean isRestoring()
protected void setRestoring(boolean restoring)
public org.hibernate.Session getSession()
public org.hibernate.Transaction getTransaction()
public void closeSession()
public void closeFactory()
public java.lang.String getStatistics()
public void setStatisticsEnabled(boolean enabled)
public boolean isStatisticsEnabled()
public boolean startTransaction() throws YPersistenceException
YPersistenceException
- if there's a problem starting a transactionprotected void storeObject(java.lang.Object obj) throws YPersistenceException
obj
- The object to be persistedYPersistenceException
protected void updateObject(java.lang.Object obj) throws YPersistenceException
obj
- The object to be persistedYPersistenceException
protected void deleteObject(java.lang.Object obj) throws YPersistenceException
obj
- The object to be persistedYPersistenceException
public void storeObjectFromExternal(java.lang.Object obj) throws YPersistenceException
storeObject(Object)
but is public in scope.obj
- The object to be persistedYPersistenceException
public void updateObjectExternal(java.lang.Object obj) throws YPersistenceException
updateObject(Object)
but is public in scope.obj
- The object to be persistedYPersistenceException
public void deleteObjectFromExternal(java.lang.Object obj) throws YPersistenceException
deleteObject(Object)
but is public in scope.obj
- The object to be unpersistedYPersistenceException
public void commit() throws YPersistenceException
YPersistenceException
protected void rollbackTransaction() throws YPersistenceException
YPersistenceException
public org.hibernate.Query createQuery(java.lang.String queryString) throws YPersistenceException
YPersistenceException
public java.util.List execQuery(java.lang.String queryString) throws YPersistenceException
YPersistenceException
public java.util.List execQuery(org.hibernate.Query query) throws YPersistenceException
query
- - the sql query to executeYPersistenceException
- if there's a problem reading the dbpublic java.util.List getObjectsForClass(java.lang.String className) throws YPersistenceException
className
- - the name of the class to retrieve instances ofYPersistenceException
- if there's a problem reading the dbpublic java.util.List getObjectsForClassWhere(java.lang.String className, java.lang.String whereClause) throws YPersistenceException
className
- the name of the class to retrieve instances ofwhereClause
- the condition (without the 'where' part) e.g. "age=21"YPersistenceException
- if there's a problem reading the dbpublic java.lang.Object selectScalar(java.lang.String className, java.lang.String field, java.lang.String value) throws YPersistenceException
className
- - the type of object to selectfield
- - the column name which contains the queried valuevalue
- - the value to find in the 'field' columnYPersistenceException
public java.lang.Object selectScalar(java.lang.String className, java.lang.String field, long value) throws YPersistenceException
YPersistenceException
Copyright © 2004-2014 The YAWL Foundation.