Package org.apache.openjpa.jdbc.kernel
Class SelectResultObjectProvider
- java.lang.Object
-
- org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider
-
- All Implemented Interfaces:
ResultObjectProvider,Closeable
- Direct Known Subclasses:
InstanceResultObjectProvider,PagingResultObjectProvider
public abstract class SelectResultObjectProvider extends java.lang.Object implements ResultObjectProvider
Abstract provider implementation wrapped around aSelect.- Author:
- Abe White
-
-
Constructor Summary
Constructors Constructor Description SelectResultObjectProvider(SelectExecutor sel, JDBCStore store, JDBCFetchConfiguration fetch)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanabsolute(int pos)Move to the given 0-based position.voidclose()Free the resources associated with this provider.JDBCFetchConfigurationgetFetchConfiguration()ResultgetResult()SelectExecutorgetSelect()JDBCStoregetStore()voidhandleCheckedException(java.lang.Exception e)Any checked exceptions that are thrown will be passed to this method.booleannext()Advance the input to the next position.voidopen()Open the result.voidreset()Reset this provider.protected voidsetSize(int size)Allow subclasses that know the size to set it; otherwise we calculate it internally.intsize()Return the number of items in the input, orInteger.MAX_VALUEif the size in unknown.booleansupportsRandomAccess()Return true if this provider supports random access.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.openjpa.lib.rop.ResultObjectProvider
getResultObject
-
-
-
-
Field Detail
-
_res
protected Result _res
-
-
Constructor Detail
-
SelectResultObjectProvider
public SelectResultObjectProvider(SelectExecutor sel, JDBCStore store, JDBCFetchConfiguration fetch)
Constructor.- Parameters:
sel- the select to executestore- the store to delegate loading tofetch- the fetch configuration, or null for the default
-
-
Method Detail
-
getSelect
public SelectExecutor getSelect()
-
getStore
public JDBCStore getStore()
-
getFetchConfiguration
public JDBCFetchConfiguration getFetchConfiguration()
-
getResult
public Result getResult()
-
supportsRandomAccess
public boolean supportsRandomAccess()
Description copied from interface:ResultObjectProviderReturn true if this provider supports random access.- Specified by:
supportsRandomAccessin interfaceResultObjectProvider
-
open
public void open() throws java.sql.SQLExceptionDescription copied from interface:ResultObjectProviderOpen the result. This will be called beforeResultObjectProvider.next(),ResultObjectProvider.absolute(int), orResultObjectProvider.size().- Specified by:
openin interfaceResultObjectProvider- Throws:
java.sql.SQLException
-
next
public boolean next() throws java.sql.SQLExceptionDescription copied from interface:ResultObjectProviderAdvance the input to the next position. Returntrueif there is more data; otherwisefalse.- Specified by:
nextin interfaceResultObjectProvider- Throws:
java.sql.SQLException
-
absolute
public boolean absolute(int pos) throws java.sql.SQLExceptionDescription copied from interface:ResultObjectProviderMove to the given 0-based position. This method is only called for providers that support random access. Returntrueif there is data at this position; otherwisefalse. This may be invoked in place ofResultObjectProvider.next().- Specified by:
absolutein interfaceResultObjectProvider- Throws:
java.sql.SQLException
-
size
public int size() throws java.sql.SQLExceptionDescription copied from interface:ResultObjectProviderReturn the number of items in the input, orInteger.MAX_VALUEif the size in unknown.- Specified by:
sizein interfaceResultObjectProvider- Throws:
java.sql.SQLException
-
setSize
protected void setSize(int size)
Allow subclasses that know the size to set it; otherwise we calculate it internally.
-
reset
public void reset() throws java.sql.SQLExceptionDescription copied from interface:ResultObjectProviderReset this provider. This is an optional operation. If supported, it should move the position of the provider to before the first element. Non-random-access providers may be able to support this method by re-acquiring all resources as if the result were just opened.- Specified by:
resetin interfaceResultObjectProvider- Throws:
java.sql.SQLException
-
close
public void close()
Description copied from interface:ResultObjectProviderFree the resources associated with this provider.- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceResultObjectProvider
-
handleCheckedException
public void handleCheckedException(java.lang.Exception e)
Description copied from interface:ResultObjectProviderAny checked exceptions that are thrown will be passed to this method. The provider should re-throw the exception as an appropriate unchecked exception.- Specified by:
handleCheckedExceptionin interfaceResultObjectProvider
-
-