|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.mguennewig.pobjects.AbstractContainer
de.mguennewig.pobjects.event.ContainerWrapper
public class ContainerWrapper
This is a simple wrapper around a database container to notify about (possible) database changes.
| 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 | |
|---|---|
ContainerWrapper(Container db)
Creates a new ContainerWrapper. |
|
| Method Summary | |
|---|---|
void |
addPObjContainerListener(PObjContainerListener l)
Adds a new container listener that will be notified about database changes done by the pobject library. |
void |
beginTransaction()
Starts a new transaction. |
void |
close()
|
void |
commitTransaction()
Commits all statements since the last Container.beginTransaction(). |
int |
deleteAll(ClassDecl cdecl)
Deletes all entries within the specified table. |
int |
deleteAll(ClassDecl cl,
Column fk,
java.lang.Object value)
Deletes all entries within the specified table whose foreign key fk equals the given value. |
void |
deleteObject(PObject obj)
Deletes the given persistent object from the database. |
boolean |
deleteRecord(Record obj)
|
int |
getCapabilities()
Returns the capabilities of the DBMS. |
Container |
getContainer()
Returns the wrapped/watched database container. |
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 |
getSequenceCurrentValue(Sequence seq)
Returns the current value of the given sequence. |
java.lang.String |
getSequenceNextValue(Sequence seq)
Returns a new value of the given sequence. |
java.lang.String |
insertObject(PObject obj)
Inserts the given object into the database. |
boolean |
insertRecord(Record obj)
|
EvalContext |
newEvalContext(int numColumns)
|
Query |
newQuery()
Creates a new empty query. |
void |
notifyChange(PObject obj,
boolean reverted)
Notifies this container that the object has been changed. |
void |
removePObjContainerListener(PObjContainerListener l)
Removes the given container listener for the list of notifiers. |
void |
reset()
Resets the container. |
void |
retrieveData(PObject obj)
Retrieves the data for the given persistent object from the database. |
void |
rollbackTransaction()
Rolls back all statements since the last Container.beginTransaction(). |
void |
updateObject(PObject obj)
Updates the given persistent object in the database. |
| Methods inherited from class de.mguennewig.pobjects.AbstractContainer |
|---|
createObject, deleteAll, getClassDecl, getClassDecls, getData, getDictionary, getObject, getQualifiedName, getSchema, getTableExpr, isStrictMode, makePersistent, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, setStrictMode, storeAll, supportsBoolean, supportsInherits, supportsLimitOffset, supportsOracleJoin, supportsSQL99Join, useArrayForLob, useStreamToInsertLob |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ContainerWrapper(Container db)
| Method Detail |
|---|
public void addPObjContainerListener(PObjContainerListener l)
public void removePObjContainerListener(PObjContainerListener l)
public final Container getContainer()
public int getCapabilities()
SUPPORTS_* constants."
public void beginTransaction()
throws PObjSQLException
beginTransaction in interface ContainerbeginTransaction in class AbstractContainerPObjSQLException - 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 ContainercommitTransaction in class AbstractContainerPObjSQLException - 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 ContainerrollbackTransaction in class AbstractContainerPObjSQLException - 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 Containerreset in class AbstractContainerContainer.rollbackTransaction()
public void close()
throws PObjSQLException
PObjSQLException
public java.lang.String getSequenceCurrentValue(Sequence seq)
throws PObjSQLException
PObjSQLException - if any database error occurs.
public java.lang.String getSequenceNextValue(Sequence seq)
throws PObjSQLException
PObjSQLException - if any database error occurs.
public boolean insertRecord(Record obj)
throws PObjConstraintException,
PObjSQLException
PObjConstraintException
PObjSQLException
public boolean deleteRecord(Record obj)
throws PObjConstraintException,
PObjSQLException
PObjConstraintException
PObjSQLException
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 ContainergetObject in class AbstractContainerContainer.getData(TableExpr),
Container.retrieveData(PObject)
public java.lang.String insertObject(PObject obj)
throws PObjConstraintException,
PObjSQLException
PObjConstraintException - if a database constraint will be violated.
PObjSQLException - if any other database error occurs.
public void updateObject(PObject obj)
throws PObjConstraintException,
PObjSQLException
PObjConstraintException - if a database constraint will be violated.
PObjSQLException - if any other database error occurs.PObject.isPersistent()
public void deleteObject(PObject obj)
throws PObjConstraintException,
PObjSQLException
PObjConstraintException - if a database constraint will be violated.
PObjSQLException - if any other database error occurs.PObject.isPersistent()
public void notifyChange(PObject obj,
boolean reverted)
notifyChange in interface ContainernotifyChange in class AbstractContainerPObject.set(Column,Object),
PObject.revert()
public int deleteAll(ClassDecl cdecl)
throws PObjConstraintException,
PObjSQLException
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().
PObjConstraintException - if a database constraint will be violated.
PObjSQLException - if any other database error occurs.
public int deleteAll(ClassDecl cl,
Column fk,
java.lang.Object value)
throws PObjSQLException,
PObjConstraintException
fk equals the given value.
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().
PObjSQLException - if any other database error occurs.
PObjConstraintException - if a database constraint will be violated.public void retrieveData(PObject obj)
public EvalContext newEvalContext(int numColumns)
public Query newQuery()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||