org.datanucleus.store.mapped.expression
Interface Queryable


public interface Queryable

Indicates an object that can be queried, such as an Extent or persistent collection.

Version:
$Revision: 1.8 $

Method Summary
 boolean isEmpty()
          Returns true if this collection contains no elements.
 QueryExpression newQueryStatement()
          Returns a proto-typical query statement over the underlying collection.
 QueryExpression newQueryStatement(java.lang.Class candidateClass, DatastoreIdentifier candidateAlias)
          Returns a prototypical query statement over the underlying collection, pre-filtered to include only objects of the specified class.
 ResultObjectFactory newResultObjectFactory(QueryExpression stmt, boolean ignoreCache, java.lang.Class resultClass, boolean useFetchPlan)
          Returns a suitable query result factory for results produced by the specified query.
 

Method Detail

newQueryStatement

QueryExpression newQueryStatement()
Returns a proto-typical query statement over the underlying collection.

The returned query statement selects all applicable rows from the relevant base table(s) and the column that represents the element or element ID. The statement can then be modified to join additional tables, select more columns, add WHERE conditions, etc.

Returns:
The new prototypical query statement.

newQueryStatement

QueryExpression newQueryStatement(java.lang.Class candidateClass,
                                  DatastoreIdentifier candidateAlias)
Returns a prototypical query statement over the underlying collection, pre-filtered to include only objects of the specified class.

Parameters:
candidateClass - Candidate class
candidateAlias - Alias to use for the candidate in the query (if the native query supports it)
Returns:
The new prototypical query statement.
Throws:
NucleusUserException - If candidateClass is not the same as or a subclass of the defined element type for this collection.

newResultObjectFactory

ResultObjectFactory newResultObjectFactory(QueryExpression stmt,
                                           boolean ignoreCache,
                                           java.lang.Class resultClass,
                                           boolean useFetchPlan)
Returns a suitable query result factory for results produced by the specified query.

The stmt argument must have been obtained by a previous call to newQueryStatement() on the same Queryable.

Parameters:
stmt - The query statement
ignoreCache - Whether to ignore the cache
resultClass - Create objects of a particular type
useFetchPlan - whether to use the fetch plan to retrieve fields in the same query
Returns:
A factory for creating PersistenceCapable objects from query results.

isEmpty

boolean isEmpty()
Returns true if this collection contains no elements.

Returns:
true if this collection contains no elements.


Copyright © 2010. All Rights Reserved.