|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.mguennewig.pobjects.AbstractContainer
public abstract class AbstractContainer
Abstract base class for database connections.
| Field Summary |
|---|
| Fields inherited from interface de.mguennewig.pobjects.Container |
|---|
SUPPORTS_BOOLEAN, SUPPORTS_INHERITS, SUPPORTS_JOIN, SUPPORTS_LIMIT_OFFSET, SUPPORTS_ORACLE_JOIN, SUPPORTS_SQL99_JOIN, USE_ARRAY_FOR_LOB, USE_STREAM_TO_INSERT_LOB |
| Constructor Summary | |
|---|---|
AbstractContainer(PObjDictionary dict,
java.lang.String schema)
Creates a container without a connection to any DBMS. |
|
| Method Summary | |
|---|---|
void |
beginTransaction()
Starts a new transaction. |
void |
commitTransaction()
Commits all statements since the last Container.beginTransaction(). |
Record |
createObject(TableExpr te)
Creates a new Record instance for the given
table expression without any binding to this container. |
int |
deleteAll(java.lang.Class<? extends Record> tableClass)
Deletes all entries within the specified table. |
ClassDecl |
getClassDecl(java.lang.String schemaName)
Returns the meta data definition for the table with the given schema name. |
java.util.Iterator<ClassDecl> |
getClassDecls()
Returns an Iterator over all known
class declarations. |
Record |
getData(TableExpr te)
Returns a Record instance for the given
table expression without reading any data from the DB. |
PObjDictionary |
getDictionary()
Returns the used meta data dictionary. |
PObject |
getObject(java.lang.Class<? extends PObject> tableClass,
java.lang.String id)
Returns a PObject instance for the given table class without
reading any data from the DB. |
PObject |
getObject(ClassDecl te,
java.lang.String id)
Returns a PObject instance for the given
table expression without reading any data from the DB. |
java.lang.String |
getQualifiedName(SqlEntity entity)
Returns the qualified name for the given SQL entity. |
java.lang.String |
getSchema()
Returns the database schema prefix that is used to access the SQL entities. |
TableExpr |
getTableExpr(java.lang.Class<? extends Record> tableClass)
|
boolean |
isStrictMode()
Tests whether modified but unstored persistent objects will be denied upon a commit. |
void |
makePersistent(PObject obj)
Creates the connection between the object and the database container. |
Query |
newQuery(java.lang.Class<? extends Record> tableClass)
Creates a new query for all rows of the given table expression. |
Query |
newQuery(java.lang.Class<? extends Record>[] tableClasses,
Predicate[] filters)
Creates a new query with a filter on the given table expression. |
Query |
newQuery(java.lang.Class<? extends Record> tableClass,
Predicate filter)
Creates a new query with a filter on the given table expression. |
Query |
newQuery(java.lang.Class<? extends Record> tableClass,
Predicate[] filters)
Creates a new query with a filter on the given table expression. |
Query |
newQuery(TableExpr tableExpr)
Creates a new query for all rows of the given table expression. |
Query |
newQuery(TableExpr[] tableExprs,
Predicate[] filters)
Creates a new query with a filter on the given table expressions. |
Query |
newQuery(TableExpr tableExpr,
Predicate filter)
Creates a new query with a filter on the given table expression. |
Query |
newQuery(TableExpr tableExpr,
Predicate[] filters)
Creates a new query with a filter on the given table expression. |
void |
notifyChange(PObject obj,
boolean reverted)
Notifies this container that the object has been changed. |
void |
reset()
Resets the container. |
void |
rollbackTransaction()
Rolls back all statements since the last Container.beginTransaction(). |
void |
setStrictMode(boolean strictMode)
Sets whether modified but unstored persistent objects will be denied upon a commit. |
void |
storeAll()
Stores all changed objects belonging to this container. |
boolean |
supportsBoolean()
Tests whether the database supports booleans natively. |
boolean |
supportsInherits()
Tests whether the database supports the inheritance concept natively. |
boolean |
supportsLimitOffset()
Tests whether the database supports limiting the result set. |
boolean |
supportsOracleJoin()
Tests whether the database supports Oracle style joins. |
boolean |
supportsSQL99Join()
Tests whether the database supports SQL99 style joins. |
boolean |
useArrayForLob()
Tests whether the database requires to use an byte[] or
char[] instead of a large object. |
boolean |
useStreamToInsertLob()
Tests whether the database requires to use an InputStream
or Reader instead of a large object. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface de.mguennewig.pobjects.Container |
|---|
close, deleteAll, deleteAll, deleteObject, deleteRecord, getCapabilities, getSequenceCurrentValue, getSequenceNextValue, insertObject, insertRecord, newEvalContext, newQuery, retrieveData, updateObject |
| Constructor Detail |
|---|
public AbstractContainer(PObjDictionary dict,
java.lang.String schema)
| Method Detail |
|---|
public final boolean supportsBoolean()
supportsBoolean in interface ContainerContainer.SUPPORTS_BOOLEANpublic final boolean supportsInherits()
supportsInherits in interface ContainerContainer.SUPPORTS_INHERITSpublic final boolean supportsLimitOffset()
supportsLimitOffset in interface ContainerContainer.SUPPORTS_LIMIT_OFFSETpublic final boolean supportsOracleJoin()
supportsOracleJoin in interface ContainerContainer.SUPPORTS_ORACLE_JOINpublic final boolean supportsSQL99Join()
supportsSQL99Join in interface ContainerContainer.SUPPORTS_SQL99_JOINpublic final boolean useStreamToInsertLob()
InputStream
or Reader instead of a large object.
useStreamToInsertLob in interface ContainerContainer.USE_STREAM_TO_INSERT_LOBpublic final boolean useArrayForLob()
byte[] or
char[] instead of a large object.
useArrayForLob in interface ContainerContainer.USE_ARRAY_FOR_LOBpublic final PObjDictionary getDictionary()
getDictionary in interface Containerpublic final java.lang.String getSchema()
getSchema in interface ContainerContainer.getQualifiedName(SqlEntity)public java.lang.String getQualifiedName(SqlEntity entity)
getQualifiedName in interface ContainerModule.getSchemaPrefix(),
Container.getSchema()public final boolean isStrictMode()
commit.
isStrictMode in interface Containertrue if there will be raised an exception for an
modified but unstored object upon a commit, otherwise false.public void setStrictMode(boolean strictMode)
commit.
setStrictMode in interface ContainerContainer.isStrictMode(),
Container.commitTransaction()public TableExpr getTableExpr(java.lang.Class<? extends Record> tableClass)
getTableExpr in interface Containerpublic ClassDecl getClassDecl(java.lang.String schemaName)
getClassDecl in interface ContainerContainer.getClassDecls()public final java.util.Iterator<ClassDecl> getClassDecls()
Iterator over all known
class declarations.
getClassDecls in interface Container
public void beginTransaction()
throws PObjSQLException
beginTransaction in interface ContainerPObjSQLException - if the DBMS is unable to start a new transaction.
public void commitTransaction()
throws PObjSQLException
Container.beginTransaction().
If Container.isStrictMode() yields false then just a
warning for each dirty object is written, otherwise an exception is
raised.
commitTransaction in interface ContainerPObjSQLException - if the DBMS in unable to finish the current
transaction by committing it or if an modified but unstored object is
detected while in strict mode.
public void rollbackTransaction()
throws PObjSQLException
Container.beginTransaction().
The in-memory data will be reverted also as far as possible.
rollbackTransaction in interface ContainerPObjSQLException - if the DBMS is unable to stop the current
transaction by rolling back all made changes within it.PObject.revert()public void reset()
Use this method to forget all changes made to any object.
NOTE: Any running transaction will be rolled back.
reset in interface ContainerContainer.rollbackTransaction()public Record createObject(TableExpr te)
Record instance for the given
table expression without any binding to this container.
createObject in interface ContainerContainer.getObject(ClassDecl,String),
Container.getData(TableExpr),
Class.newInstance()public Record getData(TableExpr te)
Record instance for the given
table expression without reading any data from the DB.
getData in interface ContainerContainer.getObject(ClassDecl,String),
TableExpr.isWritableClass()
public PObject getObject(ClassDecl te,
java.lang.String id)
PObject instance for the given
table expression without reading any data from the DB.
getObject in interface ContainerContainer.getData(TableExpr),
Container.retrieveData(PObject)
public PObject getObject(java.lang.Class<? extends PObject> tableClass,
java.lang.String id)
PObject instance for the given table class without
reading any data from the DB.
getObject in interface ContainerContainer.getTableExpr(Class),
Container.getObject(ClassDecl,String)public void makePersistent(PObject obj)
This method tells the object the database container and the container that this pbject is a newly created one that might be added to the DBMS.
makePersistent in interface ContainerForeignKeyConstraint
public void notifyChange(PObject obj,
boolean reverted)
notifyChange in interface ContainerPObject.set(Column,Object),
PObject.revert()
public final void storeAll()
throws PObjConstraintException,
PObjSQLException
The current implementation of this method may fail for some kinds of cyclical data references involving delete and update operations, as no reordering will be done currently. The order of the made changes to the objects will be used, so that the object which got changed first will be the first stored.
storeAll in interface ContainerPObjConstraintException
PObjSQLExceptionPObject.store()
public final int deleteAll(java.lang.Class<? extends Record> tableClass)
throws PObjSQLException,
PObjConstraintException
NOTE: The objects which represent a row of this table or refer
to rows within it aren't updated. So the best way to ensure consistency
is to finish the current active transaction before calling this method and
afterwards doing a Container.reset().
deleteAll in interface ContainerPObjSQLException - if any other database error occurs.
PObjConstraintException - if a database constraint will be violated.Container.deleteAll(ClassDecl),
Container.getTableExpr(Class)public final Query newQuery(TableExpr tableExpr)
newQuery in interface Container
public final Query newQuery(TableExpr tableExpr,
Predicate filter)
newQuery in interface Container
public final Query newQuery(TableExpr tableExpr,
Predicate[] filters)
newQuery in interface Container
public final Query newQuery(TableExpr[] tableExprs,
Predicate[] filters)
newQuery in interface Containerpublic final Query newQuery(java.lang.Class<? extends Record> tableClass)
newQuery in interface ContainerContainer.getTableExpr(Class),
Container.newQuery(TableExpr)
public final Query newQuery(java.lang.Class<? extends Record> tableClass,
Predicate filter)
newQuery in interface ContainerContainer.getTableExpr(Class),
Container.newQuery(TableExpr,Predicate)
public final Query newQuery(java.lang.Class<? extends Record> tableClass,
Predicate[] filters)
newQuery in interface ContainerContainer.getTableExpr(Class),
Container.newQuery(TableExpr,Predicate[])
public final Query newQuery(java.lang.Class<? extends Record>[] tableClasses,
Predicate[] filters)
newQuery in interface ContainerContainer.getTableExpr(Class),
Container.newQuery(TableExpr[],Predicate[])
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||