com.triactive.jdo.store
Class Query

java.lang.Object
  extended bycom.triactive.jdo.store.Query
All Implemented Interfaces:
javax.jdo.Query, java.io.Serializable
Direct Known Subclasses:
JDOQLQuery, TJDOSQLQuery

public abstract class Query
extends java.lang.Object
implements javax.jdo.Query

The Query interface allows applications to obtain persistent instances from the data store.

Author:
Mike Martin
See Also:
Query, Serialized Form

Nested Class Summary
static interface Query.ResultObjectFactory
          An object that reads result set rows and returns corresponding persistent objects from them.
 
Field Summary
protected  java.lang.Class candidateClass
           
protected  DatabaseAdapter dba
           
protected  java.lang.String filter
           
protected  java.lang.String imports
           
protected  boolean isCompiled
           
protected  java.lang.String ordering
           
protected  java.util.List parameterNames
           
protected  java.lang.String parameters
           
protected  java.util.Map parameterTypesByName
           
protected  Imports parsedImports
           
protected  PersistenceManager pm
           
protected  java.util.HashSet queryResults
           
protected  StoreManager storeMgr
           
protected  java.util.List variableNames
           
protected  java.lang.String variables
           
protected  java.util.Map variableTypesByName
           
 
Constructor Summary
Query(PersistenceManager pm, StoreManager storeMgr)
          Constructs a new query instance that uses the given persistence manager.
 
Method Summary
 void close(java.lang.Object queryResult)
          Close a query result and release any resources associated with it.
 void closeAll()
          Close all query results associated with this Query instance, and release all resources associated with them.
 void compile()
          Verify the elements of the query and provide a hint to the query to prepare and optimize an execution plan.
 void declareImports(java.lang.String imports)
          Set the import statements to be used to identify the fully qualified name of variables or parameters.
 void declareParameters(java.lang.String parameters)
          Declare the list of parameters query execution.
 void declareVariables(java.lang.String variables)
          Declare the unbound variables to be used in the query.
protected  void discardCompiled()
           
 boolean equals(java.lang.Object obj)
           
 java.lang.Object execute()
          Execute the query and return the filtered Collection.
 java.lang.Object execute(java.lang.Object p1)
          Execute the query and return the filtered Collection.
 java.lang.Object execute(java.lang.Object p1, java.lang.Object p2)
          Execute the query and return the filtered Collection.
 java.lang.Object execute(java.lang.Object p1, java.lang.Object p2, java.lang.Object p3)
          Execute the query and return the filtered Collection.
 java.lang.Object executeWithArray(java.lang.Object[] parameters)
          Execute the query and return the filtered Collection.
abstract  java.lang.Object executeWithMap(java.util.Map parameters)
          Execute the query and return the filtered Collection.
 java.lang.Class getCandidateClass()
          Get the class of the candidate instances of the query.
 boolean getIgnoreCache()
          Get the ignoreCache option setting.
 javax.jdo.PersistenceManager getPersistenceManager()
          Get the PersistenceManager associated with this Query.
 StoreManager getStoreManager()
          Get the StoreManager associated with this Query.
 int hashCode()
           
protected static boolean isValidJavaIdentifier(java.lang.String s)
           
 java.lang.Class resolveClassDeclaration(java.lang.String classDecl)
           
abstract  void setCandidates(java.util.Collection pcs)
          Set the candidate Collection to query.
abstract  void setCandidates(javax.jdo.Extent pcs)
          Set the candidate Extent to query.
 void setClass(java.lang.Class candidateClass)
          Set the class of the candidate instances of the query.
 void setFilter(java.lang.String filter)
          Set the filter for the query.
 void setIgnoreCache(boolean ignoreCache)
          Set the ignoreCache option.
 void setOrdering(java.lang.String ordering)
          Set the ordering specification for the result Collection.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pm

protected final transient PersistenceManager pm

storeMgr

protected final transient StoreManager storeMgr

dba

protected final transient DatabaseAdapter dba

candidateClass

protected java.lang.Class candidateClass

filter

protected java.lang.String filter

imports

protected java.lang.String imports

variables

protected java.lang.String variables

parameters

protected java.lang.String parameters

ordering

protected java.lang.String ordering

isCompiled

protected transient boolean isCompiled

parsedImports

protected transient Imports parsedImports

parameterNames

protected transient java.util.List parameterNames

parameterTypesByName

protected transient java.util.Map parameterTypesByName

variableNames

protected transient java.util.List variableNames

variableTypesByName

protected transient java.util.Map variableTypesByName

queryResults

protected transient java.util.HashSet queryResults
Constructor Detail

Query

public Query(PersistenceManager pm,
             StoreManager storeMgr)
Constructs a new query instance that uses the given persistence manager.

Parameters:
pm - the associated persistence manager for this query.
Method Detail

discardCompiled

protected void discardCompiled()

equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()

getStoreManager

public StoreManager getStoreManager()
Get the StoreManager associated with this Query.

Returns:
the StoreManager associated with this Query.

getPersistenceManager

public javax.jdo.PersistenceManager getPersistenceManager()
Get the PersistenceManager associated with this Query.

Specified by:
getPersistenceManager in interface javax.jdo.Query
Returns:
the PersistenceManager associated with this Query.
See Also:
Query.getPersistenceManager()

getCandidateClass

public java.lang.Class getCandidateClass()
Get the class of the candidate instances of the query.

Returns:
the Class of the candidate instances.
See Also:
Query.setClass(java.lang.Class)

setClass

public void setClass(java.lang.Class candidateClass)
Set the class of the candidate instances of the query.

Specified by:
setClass in interface javax.jdo.Query
Parameters:
candidateClass - the Class of the candidate instances.
See Also:
Query.setClass(java.lang.Class)

setCandidates

public abstract void setCandidates(javax.jdo.Extent pcs)
Set the candidate Extent to query.

Specified by:
setCandidates in interface javax.jdo.Query
Parameters:
pcs - the Candidate Extent.
See Also:
Query.setCandidates(javax.jdo.Extent)

setCandidates

public abstract void setCandidates(java.util.Collection pcs)
Set the candidate Collection to query.

Specified by:
setCandidates in interface javax.jdo.Query
Parameters:
pcs - the Candidate collection.
See Also:
Query.setCandidates(java.util.Collection)

setFilter

public void setFilter(java.lang.String filter)
Set the filter for the query.

Specified by:
setFilter in interface javax.jdo.Query
Parameters:
filter - the query filter.
See Also:
Query.setFilter(java.lang.String)

declareImports

public void declareImports(java.lang.String imports)
Set the import statements to be used to identify the fully qualified name of variables or parameters.

Specified by:
declareImports in interface javax.jdo.Query
Parameters:
imports - import statements separated by semicolons.
See Also:
Query.declareImports(java.lang.String)

declareParameters

public void declareParameters(java.lang.String parameters)
Declare the list of parameters query execution.

Specified by:
declareParameters in interface javax.jdo.Query
Parameters:
parameters - the list of parameters separated by commas.
See Also:
Query.declareParameters(java.lang.String)

declareVariables

public void declareVariables(java.lang.String variables)
Declare the unbound variables to be used in the query.

Specified by:
declareVariables in interface javax.jdo.Query
Parameters:
variables - the variables separated by semicolons.
See Also:
Query.declareVariables(java.lang.String)

setOrdering

public void setOrdering(java.lang.String ordering)
Set the ordering specification for the result Collection.

Specified by:
setOrdering in interface javax.jdo.Query
Parameters:
ordering - the ordering specification.
See Also:
Query.setOrdering(java.lang.String)

setIgnoreCache

public void setIgnoreCache(boolean ignoreCache)
Set the ignoreCache option.

This implementation does not support the ignore cache option, so this method does nothing.

Specified by:
setIgnoreCache in interface javax.jdo.Query
Parameters:
ignoreCache - the setting of the ignoreCache option.
See Also:
Query.setIgnoreCache(boolean)

getIgnoreCache

public boolean getIgnoreCache()
Get the ignoreCache option setting.

This implementation does not support the ignore cache option, so this method always returns false.

Specified by:
getIgnoreCache in interface javax.jdo.Query
Returns:
the ignoreCache option setting, always false.
See Also:
Query.getIgnoreCache(), setIgnoreCache(boolean)

compile

public void compile()
Verify the elements of the query and provide a hint to the query to prepare and optimize an execution plan.

Specified by:
compile in interface javax.jdo.Query
See Also:
Query.compile()

isValidJavaIdentifier

protected static boolean isValidJavaIdentifier(java.lang.String s)

resolveClassDeclaration

public java.lang.Class resolveClassDeclaration(java.lang.String classDecl)

execute

public java.lang.Object execute()
Execute the query and return the filtered Collection.

Specified by:
execute in interface javax.jdo.Query
Returns:
the filtered Collection.
See Also:
Query.execute(), executeWithArray(Object[] parameters)

execute

public java.lang.Object execute(java.lang.Object p1)
Execute the query and return the filtered Collection.

Specified by:
execute in interface javax.jdo.Query
Parameters:
p1 - the value of the first parameter declared.
Returns:
the filtered Collection.
See Also:
Query.execute(Object), executeWithArray(Object[] parameters)

execute

public java.lang.Object execute(java.lang.Object p1,
                                java.lang.Object p2)
Execute the query and return the filtered Collection.

Specified by:
execute in interface javax.jdo.Query
Parameters:
p1 - the value of the first parameter declared.
p2 - the value of the second parameter declared.
Returns:
the filtered Collection.
See Also:
Query.execute(Object,Object), executeWithArray(Object[] parameters)

execute

public java.lang.Object execute(java.lang.Object p1,
                                java.lang.Object p2,
                                java.lang.Object p3)
Execute the query and return the filtered Collection.

Specified by:
execute in interface javax.jdo.Query
Parameters:
p1 - the value of the first parameter declared.
p2 - the value of the second parameter declared.
p3 - the value of the third parameter declared.
Returns:
the filtered Collection.
See Also:
Query.execute(Object,Object,Object), executeWithArray(Object[] parameters)

executeWithArray

public java.lang.Object executeWithArray(java.lang.Object[] parameters)
Execute the query and return the filtered Collection.

Specified by:
executeWithArray in interface javax.jdo.Query
Parameters:
parameters - the Object array with all of the parameters.
Returns:
the filtered Collection.
See Also:
Query.executeWithArray(Object[])

executeWithMap

public abstract java.lang.Object executeWithMap(java.util.Map parameters)
Execute the query and return the filtered Collection.

Specified by:
executeWithMap in interface javax.jdo.Query
Parameters:
parameters - the Map containing all of the parameters.
Returns:
the filtered Collection.
See Also:
Query.executeWithMap(Map), executeWithArray(Object[] parameters)

close

public void close(java.lang.Object queryResult)
Close a query result and release any resources associated with it.

Specified by:
close in interface javax.jdo.Query
Parameters:
queryResult - the result of execute(...) on this Query instance.
See Also:
Query.close(java.lang.Object)

closeAll

public void closeAll()
Close all query results associated with this Query instance, and release all resources associated with them.

Specified by:
closeAll in interface javax.jdo.Query
See Also:
Query.closeAll()


Copyright © 2001 TriActive, Inc. All Rights Reserved.