Package org.apache.cayenne.access
Interface OperationObserver
- All Superinterfaces:
OperationHints
Defines a set of callback methods that allow
DataNode to pass back query
results and notify caller about exceptions.
All methods have default implementations: the result callbacks do nothing, the exception callbacks rethrow the
reported exception wrapped in a CayenneRuntimeException, and isIteratedResult() returns false. An
implementation only needs to override the callbacks it cares about.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanReturns whether results should be returned as aResultIterator.default voidnextBatchCount(Query query, int[] resultCount) Callback method invoked after a batch update is executed.default voidCallback method invoked after an updating query is executed.default voidCallback method invoked after each batch of generated values is read during an update.default voidCallback method invoked on exceptions that are not tied to a specific query execution, such as JDBC connection exceptions, etc.default voidnextQueryException(Query query, Exception ex) Callback method invoked on exceptions that happen during an execution of a specific query.default voidCallback method invoked for each processed ResultSet.default voidnextRows(Query q, ResultIterator<?> it) Callback method invoked for each opened ResultIterator.default voidnextStatement(Query query, TranslatedStatement statement) Callback invoked with the translated form of a query (its SQL and bindings) just before the statement is executed.default voidCalled at the end of a multi-query DataNode operation.
-
Method Details
-
nextStatement
Callback invoked with the translated form of a query (its SQL and bindings) just before the statement is executed. It lets a logging observer correlate a statement with the results reported through the othernext*callbacks. The default implementation does nothing.- Since:
- 5.0
-
onSuccess
default void onSuccess()Called at the end of a multi-query DataNode operation.- Since:
- 5.0
-
isIteratedResult
default boolean isIteratedResult()Returns whether results should be returned as aResultIterator. Defaults to false.- Specified by:
isIteratedResultin interfaceOperationHints
-
nextCount
Callback method invoked after an updating query is executed. -
nextBatchCount
Callback method invoked after a batch update is executed. -
nextRows
Callback method invoked for each processed ResultSet.- Since:
- 3.0
-
nextRows
Callback method invoked for each opened ResultIterator. If this observer requested results to be returned as a ResultIterator, this method is invoked instead ofnextRows(Query, List).- Since:
- 3.0
-
nextGeneratedRows
Callback method invoked after each batch of generated values is read during an update.- Since:
- 5.0
-
nextQueryException
Callback method invoked on exceptions that happen during an execution of a specific query. The default implementation rethrows the exception wrapped in aCayenneRuntimeException. -
nextGlobalException
Callback method invoked on exceptions that are not tied to a specific query execution, such as JDBC connection exceptions, etc. The default implementation rethrows the exception wrapped in aCayenneRuntimeException.
-