FileDocCategorySizeDatePackage
ReadQuery.javaAPI DocGlassfish v2 API6153Tue May 22 16:54:50 BST 2007oracle.toplink.essentials.queryframework

ReadQuery

public abstract class ReadQuery extends DatabaseQuery

Purpose: Abstract class for all read queries.

Responsibilities:

  • Caches result of query if flag is set.
author
Yvon Lavoie
since
TOPLink/Java 1.0

Fields Summary
protected int
maxRows
Used for retrieve limited rows through the query.
protected int
firstResult
Used to start query results at a specific result
protected long
queryId
Constructors Summary
public ReadQuery()
PUBLIC: Initialize the state of the query

        this.maxRows = 0;
        this.firstResult = 0;
        this.queryId = 0;
    
Methods Summary
public java.lang.ObjectbuildObject(oracle.toplink.essentials.internal.sessions.AbstractRecord row)
INTERNAL: By default return the row. Used by cursored stream.

        return row;
    
protected voidclonedQueryExecutionComplete(DatabaseQuery query, oracle.toplink.essentials.internal.sessions.AbstractSession session)
INTERNAL Used to give the subclasses oportunity to copy aspects of the cloned query to the original query.

        // Nothing by default.
    
public intgetFirstResult()
PUBLIC: Return the value that will be set for the firstResult in the returned result set

        return firstResult;
    
public intgetMaxRows()
PUBLIC: Return the limit for the maximum number of rows that any ResultSet can contain to the given number.

        return this.maxRows;
    
public longgetQueryId()
INTERNAL: This method is used to get the time in millis that this query is being executed at. it is set just prior to executing the SQL and will be used to determine which objects should be refreshed. CR #4365 CR #2698903 ... instead of using millis we will now use id's instead. Method renamed appropriately.

        return this.queryId;
    
public booleanisReadQuery()
PUBLIC: Return if this is a read query.

        return true;
    
public voidsetFirstResult(int firstResult)
PUBLIC: Used to set the first result in any result set that is returned for this query. This method should only be set once per query. To change the firstReslt use another query. This method will call the absolute method on the JDBC result set to move the initial row used by TopLink. Note: The set of results returned from the database will still include the results before the first result. TopLink will just not use them for object building.

        this.firstResult = firstResult;
        setIsPrepared(false);
        shouldCloneCall=true;
    
public voidsetMaxRows(int maxRows)
PUBLIC: Used to set the limit for the maximum number of rows that any ResultSet can contain to the given number. This method should only be set once per query. To change the max rows use another query. This method limits the number of candidate results returned to TopLink that can be used to build objects

        this.maxRows = maxRows;
        setIsPrepared(false);
        shouldCloneCall=true;
    
public voidsetQueryId(long id)
INTERNAL: This method is used to set the current system time in millis that this query is being executed at. it is set just prior to executing the SQL and will be used to determine which objects should be refreshed. CR #4365 CR #2698903 ... instead of using millis we will now use id's instead. Method renamed appropriately.

        this.queryId = id;