|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.olat.core.commons.persistence.DBJunitImpl
public class DBJunitImpl
Extends DB interface with methods for Junit testing.
| Method Summary | |
|---|---|
void |
addTransactionListener(ITransactionListener listener)
Add an ITransactionListener to this DB instance. |
void |
clearDatabase()
Delete all data from database, when used by an OLATTestCase. |
void |
closeSession()
Close the database session. |
void |
commit()
Call this to commit current changes. |
void |
commitAndCloseSession()
Checks if the transaction needs to be committed and does so if this is the case, plus closes the connection in any case guaranteed. |
DBQuery |
createQuery(java.lang.String query)
Create a DBQuery |
int |
delete(java.lang.String query,
java.lang.Object[] values,
org.hibernate.type.Type[] types)
Deletion query. |
int |
delete(java.lang.String query,
java.lang.Object value,
org.hibernate.type.Type type)
Deletion query. |
void |
deleteObject(java.lang.Object object)
Delete an object. |
java.util.List |
find(java.lang.String query)
Find objects based on query |
java.util.List |
find(java.lang.String query,
java.lang.Object[] values,
org.hibernate.type.Type[] types)
Find objects based on query |
java.util.List |
find(java.lang.String query,
java.lang.Object value,
org.hibernate.type.Type type)
Find objects based on query |
java.lang.Object |
findObject(java.lang.Class theClass,
java.lang.Long key)
Find an object. |
void |
forceSetDebugLogLevel(boolean enabled)
temp debug only |
static DBJunit |
getJunitInstance()
|
org.hibernate.stat.Statistics |
getStatistics()
Statistics must be enabled first, when you want to use it. |
void |
intermediateCommit()
Call this to intermediate commit current changes. |
boolean |
isError()
|
java.lang.Object |
loadObject(java.lang.Class theClass,
java.lang.Long key)
Load an object. |
Persistable |
loadObject(Persistable persistable)
see DB.loadObject(Persistable persistable, boolean forceReloadFromDB) |
Persistable |
loadObject(Persistable persistable,
boolean forceReloadFromDB)
loads an object if needed. |
void |
removeTransactionListener(ITransactionListener listener)
Removes an ITransactionListener from this DB instance. |
void |
rollback()
Call this to rollback current changes. |
void |
rollbackAndCloseSession()
Calls rollback and closes the connection guaranteed. |
void |
saveObject(java.lang.Object object)
Save an object. |
void |
updateObject(java.lang.Object object)
Update an object. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public boolean isError()
isError in interface DBpublic static DBJunit getJunitInstance()
public void clearDatabase()
clearDatabase in interface DBJunitpublic void closeSession()
DB
closeSession in interface DBpublic void commitAndCloseSession()
DBUse this rather than commit() directly wherever possible!
commitAndCloseSession in interface DBpublic void commit()
DB
commit in interface DBpublic void rollbackAndCloseSession()
DBNote that this method checks whether the connection and the transaction are open and if they're not, then this method doesn't do anything.
rollbackAndCloseSession in interface DBpublic void rollback()
DB
rollback in interface DBpublic DBQuery createQuery(java.lang.String query)
DB
createQuery in interface DB
public int delete(java.lang.String query,
java.lang.Object value,
org.hibernate.type.Type type)
DB
delete in interface DB
public int delete(java.lang.String query,
java.lang.Object[] values,
org.hibernate.type.Type[] types)
DB
delete in interface DBpublic void deleteObject(java.lang.Object object)
DB
deleteObject in interface DB
public java.util.List find(java.lang.String query,
java.lang.Object value,
org.hibernate.type.Type type)
DB
find in interface DB
public java.util.List find(java.lang.String query,
java.lang.Object[] values,
org.hibernate.type.Type[] types)
DB
find in interface DBpublic java.util.List find(java.lang.String query)
DB
find in interface DB
public java.lang.Object findObject(java.lang.Class theClass,
java.lang.Long key)
DB
findObject in interface DB
public java.lang.Object loadObject(java.lang.Class theClass,
java.lang.Long key)
DB
loadObject in interface DBpublic Persistable loadObject(Persistable persistable)
DB
loadObject in interface DB
public Persistable loadObject(Persistable persistable,
boolean forceReloadFromDB)
DB
loadObject in interface DBpersistable - the object which needs to be reloadedforceReloadFromDB - if true, force a reload from the db (e.g. to catch
up to an object commited by another thread which is still in this
thread's session cache
public void saveObject(java.lang.Object object)
DB
saveObject in interface DBpublic void updateObject(java.lang.Object object)
DB
updateObject in interface DBpublic org.hibernate.stat.Statistics getStatistics()
DB
getStatistics in interface DBpublic void intermediateCommit()
DB
intermediateCommit in interface DBpublic void addTransactionListener(ITransactionListener listener)
DBThe ITransactionListener will be informed about commit and rollbacks.
Adding the same listener twice has no effect.
addTransactionListener in interface DBlistener - the listener to be addedpublic void removeTransactionListener(ITransactionListener listener)
DBIf the ITransactionListener is currently not registered, this call has no effect.
removeTransactionListener in interface DBpublic void forceSetDebugLogLevel(boolean enabled)
DB
forceSetDebugLogLevel in interface DB
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||