public class HibernateEngine
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DB_DELETE |
static int |
DB_INSERT |
static int |
DB_UPDATE |
Constructor and Description |
---|
HibernateEngine(boolean persistenceOn,
java.util.Set<java.lang.Class> classes) |
HibernateEngine(boolean persistenceOn,
java.util.Set<java.lang.Class> classes,
java.util.Properties props)
The constuctor - called from getInstance()
|
Modifier and Type | Method and Description |
---|---|
org.hibernate.Transaction |
beginTransaction() |
void |
closeFactory() |
void |
commit() |
org.hibernate.Query |
createQuery(java.lang.String queryString) |
boolean |
exec(java.lang.Object obj,
int action) |
boolean |
exec(java.lang.Object obj,
int action,
boolean commit)
persists the object instance passed
|
boolean |
exec(java.lang.Object obj,
int action,
org.hibernate.Transaction tx)
persists the object instance passed
|
java.util.List |
execJoinQuery(java.lang.String table,
java.lang.String field,
java.lang.String value)
executes a join query.
|
java.util.List |
execQuery(java.lang.String queryString)
executes a Query object based on the hql string passed
|
java.util.List |
execSQLQuery(java.lang.String queryString)
executes a plain SQL Query
|
int |
execUpdate(java.lang.String queryString) |
int |
execUpdate(java.lang.String queryString,
boolean commit) |
java.lang.Object |
get(java.lang.Class claz,
java.io.Serializable key) |
java.lang.Object |
get(java.lang.Class claz,
java.io.Serializable key,
boolean doCommit) |
java.util.List |
getByCriteria(java.lang.Class claz,
boolean commit,
org.hibernate.criterion.Criterion... criteria) |
java.util.List |
getByCriteria(java.lang.Class claz,
org.hibernate.criterion.Criterion... criteria) |
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.Transaction |
getOrBeginTransaction() |
boolean |
isAvailable(java.lang.String tableName) |
boolean |
isPersisting() |
java.lang.Object |
load(java.lang.Class claz,
java.io.Serializable key) |
java.lang.Object |
load(java.lang.Class claz,
java.io.Serializable key,
boolean doCommit) |
void |
rollback() |
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 sql string passed
|
void |
setPersisting(boolean persist) |
public static final int DB_UPDATE
public static final int DB_DELETE
public static final int DB_INSERT
public HibernateEngine(boolean persistenceOn, java.util.Set<java.lang.Class> classes, java.util.Properties props) throws org.hibernate.HibernateException
org.hibernate.HibernateException
public HibernateEngine(boolean persistenceOn, java.util.Set<java.lang.Class> classes)
public boolean isAvailable(java.lang.String tableName)
public void setPersisting(boolean persist)
public boolean isPersisting()
public boolean exec(java.lang.Object obj, int action)
public boolean exec(java.lang.Object obj, int action, boolean commit)
obj
- - an instance of the object to persistaction
- - type type of action performedpublic boolean exec(java.lang.Object obj, int action, org.hibernate.Transaction tx)
obj
- - an instance of the object to persistaction
- - type type of action performedtx
- - an active Transaction object. NOTE: Any objects persisted via this
method will not be permanently actioned until the transaction is committed via
a call to 'commit()'.public org.hibernate.Transaction getOrBeginTransaction()
public java.util.List execQuery(java.lang.String queryString)
queryString
- - the hibernate query to executepublic java.util.List execSQLQuery(java.lang.String queryString)
queryString
- - the SQL query to executepublic int execUpdate(java.lang.String queryString)
public int execUpdate(java.lang.String queryString, boolean commit)
public org.hibernate.Query createQuery(java.lang.String queryString)
public org.hibernate.Transaction beginTransaction()
public java.lang.Object load(java.lang.Class claz, java.io.Serializable key)
public java.lang.Object load(java.lang.Class claz, java.io.Serializable key, boolean doCommit)
public java.lang.Object get(java.lang.Class claz, java.io.Serializable key)
public java.lang.Object get(java.lang.Class claz, java.io.Serializable key, boolean doCommit)
public java.util.List getByCriteria(java.lang.Class claz, org.hibernate.criterion.Criterion... criteria)
public java.util.List getByCriteria(java.lang.Class claz, boolean commit, org.hibernate.criterion.Criterion... criteria)
public void commit()
public void rollback()
public void closeFactory()
public java.util.List execJoinQuery(java.lang.String table, java.lang.String field, java.lang.String value)
table
- the parent table - returned objects are of this classfield
- the property name of the [Set] column in the parent tablevalue
- the id of the child object in the set to matchpublic java.lang.Object selectScalar(java.lang.String className, java.lang.String field, java.lang.String value)
className
- - the type of object to selectfield
- - the column name which contains the queried valuevalue
- - the value to find in the 'field' columnpublic java.util.List getObjectsForClass(java.lang.String className)
className
- - the name of the class to retrieve instances ofpublic java.util.List getObjectsForClassWhere(java.lang.String className, java.lang.String whereClause)
className
- the name of the class to retrieve instances ofwhereClause
- the condition (without the 'where' part) e.g. "age=21"Copyright © 2004-2014 The YAWL Foundation.