org.datanucleus.store.db4o.query
Class NativeQuery

java.lang.Object
  extended by org.datanucleus.store.query.Query
      extended by org.datanucleus.store.query.AbstractJavaQuery
          extended by org.datanucleus.store.db4o.query.NativeQuery
All Implemented Interfaces:
java.io.Serializable

public class NativeQuery
extends org.datanucleus.store.query.AbstractJavaQuery

Representation of a DB4O "Native" query for use in JPOX. Created by passing in the predicate object. A DB4O native query is not compiled as such, with all work being performed at execution. Any "comparator" for the native query can be specified via the query extension "db4o.native.comparator".

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.datanucleus.store.query.Query
org.datanucleus.store.query.Query.SubqueryDefinition
 
Field Summary
protected static org.datanucleus.util.Localiser LOCALISER_DB4O
          Localiser for messages.
protected  com.db4o.query.Predicate predicate
          The Predicate for the native query.
 
Fields inherited from class org.datanucleus.store.query.AbstractJavaQuery
candidateCollection, candidateExtent, singleString
 
Fields inherited from class org.datanucleus.store.query.Query
BULK_DELETE, BULK_UPDATE, candidateClass, candidateClassName, compilation, explicitParameters, explicitVariables, extensions, filter, from, fromInclNo, fromInclParam, grouping, having, ignoreCache, implicitParameters, imports, LOCALISER, om, ordering, OTHER, parameterNames, parsedImports, queryResults, range, result, resultClass, resultClassName, resultDistinct, SELECT, subclasses, subqueries, tasks, toExclNo, toExclParam, type, unique, unmodifiable, update
 
Constructor Summary
NativeQuery(org.datanucleus.ObjectManager om)
          Constructs a new query instance that uses the given persistence manager.
NativeQuery(org.datanucleus.ObjectManager om, java.lang.Object predicate)
          Constructor for a query using DB4O "native" query language.
 
Method Summary
protected  void compileInternal(boolean forExecute, java.util.Map parameterValues)
          Method to compile the query.
 java.lang.String getSingleStringQuery()
          Method to return the query as a single string.
 java.util.Set<java.lang.String> getSupportedExtensions()
          Method to return the names of the extensions supported by this query.
protected  boolean isCompiled()
          Method to return if the query is compiled.
protected  java.lang.Object performExecute(java.util.Map parameters)
          Method to execute the query.
protected  boolean shouldReturnSingleRow()
          Convenience method to return whether the query should return a single row.
 
Methods inherited from class org.datanucleus.store.query.AbstractJavaQuery
discardCompiled, evaluateInMemory, getCandidateCollection, getCandidateExtent, performDeletePersistentAll, setCandidates, setCandidates, toString
 
Methods inherited from class org.datanucleus.store.query.Query
addExtension, addSubquery, applyImplicitParameterValueToCompilation, applyRangeChecks, assertIsModifiable, assertSupportsCancel, cancel, cancel, checkParameterTypesAgainstCompilation, close, closeAll, compile, declareExplicitParameters, declareExplicitVariables, declareImports, deletePersistentAll, deletePersistentAll, deletePersistentAll, equals, execute, executeQuery, executeWithArray, executeWithMap, getBooleanExtensionProperty, getCandidateClass, getCandidateClassName, getCompilation, getDatastoreReadTimeoutMillis, getDatastoreWriteTimeoutMillis, getExplicitParameters, getExplicitVariables, getExtension, getExtensions, getFetchPlan, getFilter, getFrom, getGrouping, getHaving, getIgnoreCache, getImplicitParameters, getImports, getInputParameters, getLanguage, getObjectManager, getOrdering, getParameterMapForValues, getParsedImports, getQueryManager, getRange, getRangeFromIncl, getRangeFromInclParam, getRangeToExcl, getRangeToExclParam, getResult, getResultClass, getResultClassName, getResultDistinct, getSerializeRead, getStoreManager, getSubqueryForVariable, getType, getUpdate, hashCode, hasSubqueryForVariable, isSubclasses, isUnique, isUnmodifiable, performExecuteInternal, performExecuteTask, prepareDatastore, resolveClassDeclaration, setCandidateClassName, setClass, setCompilation, setDatastoreReadTimeoutMillis, setDatastoreWriteTimeoutMillis, setExtensions, setFetchPlan, setFilter, setFrom, setGrouping, setHaving, setIgnoreCache, setImplicitParameter, setImplicitParameter, setOrdering, setRange, setRange, setResult, setResultClass, setResultClassName, setResultDistinct, setResultMetaData, setSerializeRead, setSubclasses, setType, setUnique, setUnmodifiable, setUpdate, supportsTimeout, useCaching, useFetchPlan, useResultsCaching
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

LOCALISER_DB4O

protected static final org.datanucleus.util.Localiser LOCALISER_DB4O
Localiser for messages.


predicate

protected com.db4o.query.Predicate predicate
The Predicate for the native query.

Constructor Detail

NativeQuery

public NativeQuery(org.datanucleus.ObjectManager om)
Constructs a new query instance that uses the given persistence manager.

Parameters:
om - the associated ObjectManager for this query.

NativeQuery

public NativeQuery(org.datanucleus.ObjectManager om,
                   java.lang.Object predicate)
Constructor for a query using DB4O "native" query language. The second parameter must implement "com.db4o.query.Predicate".

Parameters:
om - The persistence manager
predicate - The native query predicate
Throws:
org.datanucleus.exceptions.NucleusUserException - When the second parameter isnt an implementation of a Predicate
Method Detail

compileInternal

protected void compileInternal(boolean forExecute,
                               java.util.Map parameterValues)
Method to compile the query. We have nothing to compile with db4o native queries since all is done at execution.

Specified by:
compileInternal in class org.datanucleus.store.query.Query
Parameters:
forExecute - Whether to compile ready for execution

isCompiled

protected boolean isCompiled()
Method to return if the query is compiled.

Overrides:
isCompiled in class org.datanucleus.store.query.Query
Returns:
Whether it is compiled

performExecute

protected java.lang.Object performExecute(java.util.Map parameters)
Method to execute the query.

Specified by:
performExecute in class org.datanucleus.store.query.Query
Parameters:
parameters - Map of parameter values keyed by the name
Returns:
The query result

shouldReturnSingleRow

protected boolean shouldReturnSingleRow()
Convenience method to return whether the query should return a single row.

Overrides:
shouldReturnSingleRow in class org.datanucleus.store.query.Query
Returns:
Whether a single row should result

getSingleStringQuery

public java.lang.String getSingleStringQuery()
Method to return the query as a single string.

Specified by:
getSingleStringQuery in class org.datanucleus.store.query.AbstractJavaQuery
Returns:
The single string

getSupportedExtensions

public java.util.Set<java.lang.String> getSupportedExtensions()
Method to return the names of the extensions supported by this query. To be overridden by subclasses where they support additional extensions.

Overrides:
getSupportedExtensions in class org.datanucleus.store.query.AbstractJavaQuery
Returns:
The supported extension names


Copyright © 2010. All Rights Reserved.