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

ValueReadQuery

public class ValueReadQuery extends DirectReadQuery

Purpose: Concrete class to perform a read of a single data value.

Responsibilities: Used in conjunction with CursoredStream size and Platform getSequence. This can be used to read a single data value (i.e. one field). A single data value is returned, or null if no rows are returned.

author
James Sutherland
since
TOPLink/Java 1.2

Fields Summary
Constructors Summary
public ValueReadQuery()
PUBLIC: Initialize the state of the query.

        super();
    
public ValueReadQuery(String sqlString)
PUBLIC: Initialize the query to use the specified SQL string.

        super(sqlString);
    
public ValueReadQuery(Call call)
PUBLIC: Initialize the query to use the specified call.

        super(call);
    
Methods Summary
public java.lang.ObjectexecuteDatabaseQuery()
INTERNAL: Execute the query. Perform the work to execute the SQL string.

exception
DatabaseException an error has occurred on the database
return
Object the data value or null.

        Object values = super.executeDatabaseQuery();
        ContainerPolicy cp = getContainerPolicy();
        if (cp.sizeFor(values) == 0) {
            return null;
        } else {
            return cp.next(cp.iteratorFor(values), getSession());
        }