org.datanucleus.store.rdbms.query
Class AbstractRDBMSQueryResult

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList
          extended by org.datanucleus.store.query.AbstractQueryResult
              extended by org.datanucleus.store.rdbms.query.AbstractRDBMSQueryResult
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable, java.util.Collection, java.util.List, org.datanucleus.store.query.QueryResult
Direct Known Subclasses:
ForwardQueryResult, ScrollableQueryResult

public abstract class AbstractRDBMSQueryResult
extends org.datanucleus.store.query.AbstractQueryResult

Abstract representation of a QueryResult for RDBMS queries. Based on the assumption that we have a JDBC ResultSet, and we are extracting the results using a ResultObjectFactory.

See Also:
Serialized Form

Field Summary
protected  org.datanucleus.store.query.ResultObjectFactory rof
          ResultObjectFactory for converting the result set into objects.
protected  java.sql.ResultSet rs
          The ResultSet containing the results.
 
Fields inherited from class org.datanucleus.store.query.AbstractQueryResult
closed, connectionListeners, loadResultsAtCommit, LOCALISER, query, resultSizeMethod, size
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
AbstractRDBMSQueryResult(org.datanucleus.store.query.Query query, org.datanucleus.store.query.ResultObjectFactory rof, java.sql.ResultSet rs)
          Constructor of the result from a Query.
 
Method Summary
 void close()
          Method to close the results, meaning that they are inaccessible after this point.
protected  void closeResults()
          Internal method to close the ResultSet.
 void disconnect()
          Method to disconnect the results from the ObjectManager, meaning that thereafter it just behaves like a List.
protected  int getSizeUsingCount()
          Convenience method to return the size of the query results using a COUNT(*) query in the datastore.
 int hashCode()
          Override for compatibility with equals().
 
Methods inherited from class org.datanucleus.store.query.AbstractQueryResult
add, add, addAll, addConnectionListener, assertIsOpen, clear, closingConnection, contains, containsAll, equals, get, getSizeUsingMethod, indexOf, isEmpty, isOpen, iterator, lastIndexOf, listIterator, remove, set, size, subList, toArray, toArray
 
Methods inherited from class java.util.AbstractList
listIterator, removeRange
 
Methods inherited from class java.util.AbstractCollection
addAll, remove, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
addAll, remove, removeAll, retainAll
 
Methods inherited from interface java.util.List
addAll, remove, removeAll, retainAll
 

Field Detail

rs

protected java.sql.ResultSet rs
The ResultSet containing the results.


rof

protected org.datanucleus.store.query.ResultObjectFactory rof
ResultObjectFactory for converting the result set into objects.

Constructor Detail

AbstractRDBMSQueryResult

public AbstractRDBMSQueryResult(org.datanucleus.store.query.Query query,
                                org.datanucleus.store.query.ResultObjectFactory rof,
                                java.sql.ResultSet rs)
Constructor of the result from a Query.

Parameters:
query - The Query
rof - The factory to retrieve results from
rs - The ResultSet from the Query Statement
Method Detail

disconnect

public void disconnect()
Method to disconnect the results from the ObjectManager, meaning that thereafter it just behaves like a List. All remaining results are read in at this point (unless selected not to be).

Specified by:
disconnect in interface org.datanucleus.store.query.QueryResult
Overrides:
disconnect in class org.datanucleus.store.query.AbstractQueryResult

close

public void close()
Method to close the results, meaning that they are inaccessible after this point.

Specified by:
close in interface org.datanucleus.store.query.QueryResult
Overrides:
close in class org.datanucleus.store.query.AbstractQueryResult

closeResults

protected void closeResults()
Internal method to close the ResultSet.

Specified by:
closeResults in class org.datanucleus.store.query.AbstractQueryResult

hashCode

public int hashCode()
Override for compatibility with equals().

Specified by:
hashCode in interface java.util.Collection
Specified by:
hashCode in interface java.util.List
Overrides:
hashCode in class org.datanucleus.store.query.AbstractQueryResult
Returns:
The hashcode

getSizeUsingCount

protected int getSizeUsingCount()
Convenience method to return the size of the query results using a COUNT(*) query in the datastore. TODO To be removed when we remove support for legacy JDOQL/JPQL

Returns:
The size


Copyright © 2009. All Rights Reserved.