public class TestDataContextStub extends Object implements QDataContext
| Constructor and Description |
|---|
TestDataContextStub() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCommitAction(IRunnable cx)
Add an action which should be executed after a succesful commit on this context.
|
void |
addListener(IQDataContextListener qDataContextListener)
Add a listener to keep track of the events on an instance.
|
void |
attach(Object o)
If the object was from an earlier database session reattach it to another, live session.
|
void |
close()
This will close and fully discard all resources belonging to this context, provided ignoreClose is
not true.
|
void |
commit() |
void |
decrement()
Internal test pps.
|
void |
delete(Object o)
Cause the object to be deleted from the database.
|
<T> T |
find(Class<T> clz,
Object pk)
Load the persistent object with the specified type and primary key from the database.
|
<T> T |
find(ICriteriaTableDef<T> metatable,
Object pk) |
<T> T |
get(Class<T> clz,
Object pk)
Load the persistent object with the specified type and primary key from the database.
|
Connection |
getConnection() |
QDataContextFactory |
getFactory()
Returns the context source which created this DataContext.
|
<T> T |
getInstance(Class<T> clz,
Object pk)
Load the persistent object with the specified type and primary key from the database.
|
<T> T |
getInstance(ICriteriaTableDef<T> clz,
Object pk) |
boolean |
inTransaction() |
<T> T |
original(T copy)
EXPERIMENTAL INTERFACE This retrieves the "original" copy of the specified instance (which must
be loaded inside this data context).
|
<R> List<R> |
query(Class<R> resultInterface,
QSelection<?> sel)
Query a selection, and return the result in the specified proxied interface.
|
<T> List<T> |
query(QCriteria<T> q)
Execute the query specified by q and return a list of results.
|
List<Object[]> |
query(QSelection<?> sel)
Issue a selection query, where multiple fields or projections on fields are selected from a base class.
|
<R> R |
queryOne(Class<R> resultInterface,
QSelection<?> sel)
Query a selection, and return the result in the specified proxied interface.
|
<T> T |
queryOne(QCriteria<T> q)
Execute the query specified by q, and expect and return at most 1 result.
|
Object[] |
queryOne(QSelection<?> sel)
Execute the selection query specified by q, and expect and return at most 1 result.
|
void |
refresh(Object o)
EXPERIMENTAL/NOT FINAL Refresh with latest content in the database.
|
void |
rollback() |
void |
save(Object o)
Cause the object to be inserted in the database.
|
void |
setIgnoreClose(boolean on)
When ignoreClose is set to T the close call must be silently ignored.
|
void |
setKeepOriginals()
EXPERIMENTAL Sets the context so that it creates "before" copies.
|
void |
startTransaction() |
int |
testGetUseCount() |
public void attach(@Nonnull Object o) throws Exception
QDataContextattach in interface QDataContextExceptionpublic void setIgnoreClose(boolean on)
QDataContextsetIgnoreClose in interface QDataContextpublic void commit()
throws Exception
commit in interface QDataContextExceptionpublic void delete(@Nonnull Object o) throws Exception
QDataContextdelete in interface QDataContextException@Nonnull public QDataContextFactory getFactory()
QDataContextgetFactory in interface QDataContextpublic <T> T find(@Nonnull Class<T> clz, @Nonnull Object pk) throws Exception
QDataContextfind in interface QDataContextT - The object type.clz - The persistent class for which an instance is being sought.pk - The PK for the instance required.Exception@Nonnull public <T> T get(@Nonnull Class<T> clz, @Nonnull Object pk) throws Exception
QDataContextQNotFoundException.get in interface QDataContextT - The object type.clz - The persistent class for which an instance is being sought.pk - The PK for the instance required.Exception@Nonnull public <T> T getInstance(@Nonnull Class<T> clz, @Nonnull Object pk) throws Exception
QDataContextQDataContext.find(Class, Object).getInstance in interface QDataContextT - The object typeclz - The persistent class for which an instance is being sought.pk - The PK for the instance required.Exception@Nonnull public Connection getConnection() throws Exception
getConnection in interface QDataContextExceptionpublic boolean inTransaction()
throws Exception
inTransaction in interface QDataContextException@Nonnull public <T> List<T> query(@Nonnull QCriteria<T> q) throws Exception
QDataContextquery in interface QDataContextT - The return type for this query, a persistent class typeq - The selection criteriaExceptionpublic <T> T queryOne(@Nonnull QCriteria<T> q) throws Exception
QDataContextqueryOne in interface QDataContextException@Nonnull public List<Object[]> query(@Nonnull QSelection<?> sel) throws Exception
QDataContextquery in interface QDataContextExceptionpublic Object[] queryOne(@Nonnull QSelection<?> sel) throws Exception
QDataContextqueryOne in interface QDataContextExceptionpublic void refresh(@Nonnull Object o) throws Exception
QDataContextrefresh in interface QDataContextExceptionpublic void rollback()
throws Exception
rollback in interface QDataContextExceptionpublic void save(@Nonnull Object o) throws Exception
QDataContextsave in interface QDataContextExceptionpublic void startTransaction()
throws Exception
startTransaction in interface QDataContextExceptionpublic <T> T find(@Nonnull ICriteriaTableDef<T> metatable, @Nonnull Object pk) throws Exception
find in interface QDataContextException@Nonnull public <T> T getInstance(@Nonnull ICriteriaTableDef<T> clz, @Nonnull Object pk) throws Exception
getInstance in interface QDataContextException@Nonnull public <R> List<R> query(@Nonnull Class<R> resultInterface, @Nonnull QSelection<?> sel) throws Exception
QDataContextQFld annotations to define the order in the result set.query in interface QDataContextException@Nullable public <R> R queryOne(@Nonnull Class<R> resultInterface, @Nonnull QSelection<?> sel) throws Exception
QDataContextQFld annotations to define the order in the result set.queryOne in interface QDataContextExceptionpublic void decrement()
public int testGetUseCount()
public void close()
QDataContextclose in interface AutoCloseableclose in interface QDataContextpublic void addCommitAction(@Nonnull IRunnable cx)
QDataContextaddCommitAction in interface QDataContextpublic void addListener(@Nonnull IQDataContextListener qDataContextListener)
QDataContextaddListener in interface QDataContextQDataContext.addListener(to.etc.webapp.query.IQDataContextListener)public <T> T original(@Nonnull T copy)
QDataContextoriginal in interface QDataContextpublic void setKeepOriginals()
QDataContextsetKeepOriginals in interface QDataContextCopyright © 2017 etc.to. All rights reserved.