public class CastorPersistenceQueryResults
extends java.lang.Object
implements de.ipcon.db.core.QueryResultsI
This class acts as a bridge between the native PersistenceHandlerI (Castor) and the
high-level QueryResultsI interface. It supports both legacy SQL calls and modern,
compiled OQL queries.
Key Features:
Predicate filtering during iteration,
minimizing the number of Business Objects (BOs) that reach the application layer.
prefetchPaths to avoid N+1 select
issues in lazy-loading scenarios.
OQLQuery,
QueryResults| Constructor and Description |
|---|
CastorPersistenceQueryResults(CastorPersistenceHandler _ph,
java.lang.String _query,
java.lang.Object[] _parms,
short _mode,
java.lang.String[] _prefetchPaths)
Constructs a new result set and immediately initiates the execution lifecycle.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Attempts to cancel the currently running database query if supported
by the underlying driver and Castor implementation.
|
void |
close()
Closes the underlying result set and the query implementation.
|
java.lang.String |
currentTag() |
boolean |
hasNext()
Checks if a next record exists, taking the optional
filterPredicate into account. |
boolean |
isClosed() |
java.lang.Object |
next()
Returns the next result object.
|
void |
remove()
Modification via iterator is not supported in Castor OQL results.
|
public CastorPersistenceQueryResults(CastorPersistenceHandler _ph, java.lang.String _query, java.lang.Object[] _parms, short _mode, java.lang.String[] _prefetchPaths)
_ph - The active CastorPersistenceHandler. Must not be finished or closed._query - The query string. If prefixed with "CALL SQL", it bypasses the OQL parser._parms - Input parameters. Null-safe; converted to empty array if null._mode - Persistence lock mode. Determines the isolation level of the fetched objects
(e.g. READ_ONLY, SHARED, EXCLUSIVE)._prefetchPaths - Attribute paths to be eagerly loaded.java.lang.IllegalStateException - If the provided PersistenceHandler is already in a 'finished' state.PersistenceException - If OQL compilation or SQL execution fails.public void close()
Closes the underlying result set and the query implementation.
In addition to resource cleanup, this method "slims" any currently held
Business Objects to aid memory reclamation and notifies the handler of
query performance metrics via ph.complainSlowQuery.
close in interface de.ipcon.db.core.QueryResultsIclose in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic boolean isClosed()
isClosed in interface de.ipcon.db.core.QueryResultsIpublic boolean hasNext()
filterPredicate into account.
If a filter is present, this method will trigger a look-ahead fetch (prefetchNextFittingBO())
to determine if a matching record exists further down the stream.
hasNext in interface java.util.Iteratornext() will return an object.LockNotGrantedException - if a database lock prevents reading the next row.PersistenceException - if there was a problem when accessing the underlying database.public java.lang.Object next()
If the persistence handler is not in a "saving" transaction, the previously returned BO is slimmed before returning the new one to keep the memory footprint minimal during large iterations.
next in interface java.util.Iteratorpublic void remove()
remove in interface java.util.Iteratorjava.lang.IllegalStateException - always.public java.lang.String currentTag()
currentTag in interface de.ipcon.db.core.QueryResultsIpublic void cancel()
cancel in interface de.ipcon.db.core.QueryResultsICopyright © 2000-2026 OAshi S.à r.l. All Rights Reserved.