Package org.apache.openjpa.jdbc.kernel
Class PagingResultObjectProvider
- java.lang.Object
-
- org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider
-
- org.apache.openjpa.jdbc.kernel.PagingResultObjectProvider
-
- All Implemented Interfaces:
ResultObjectProvider,Closeable
public class PagingResultObjectProvider extends SelectResultObjectProvider
Object provider implementation that fetches one page of results at a a time as it scrolls. If thegetPagedFields(org.apache.openjpa.jdbc.sql.Select, org.apache.openjpa.jdbc.meta.ClassMapping, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration, int, long)method returns a non-null bit set, this this provider is a good fit for your configuration. The method tests the following conditions:- The eager fetch mode is
parallel. - The select's result should be treated as a large result set.
- The mapping being selected has fields that use parallel selects under the current fetch configuration.
join. This provider will take care of performingparallelmode batch selects for each page it reads.- Author:
- Abe White
-
-
Field Summary
-
Fields inherited from class org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider
_res
-
-
Constructor Summary
Constructors Constructor Description PagingResultObjectProvider(SelectExecutor sel, ClassMapping[] mappings, JDBCStore store, JDBCFetchConfiguration fetch, java.util.BitSet[] paged, long size)Constructor.PagingResultObjectProvider(SelectExecutor sel, ClassMapping mapping, JDBCStore store, JDBCFetchConfiguration fetch, java.util.BitSet paged, long size)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanabsolute(int pos)Move to the given 0-based position.static java.util.BitSetgetPagedFields(Select sel, ClassMapping mapping, JDBCStore store, JDBCFetchConfiguration fetch, int eagerMode, long size)Return a bit set representing batch select fields that will be paged, or null if no fields need paging, which indicates that this provider should not be used.intgetPageSize()Return the page size in use.java.lang.ObjectgetResultObject()Instantiate the current result object.booleannext()Advance the input to the next position.voidopen()Open the result.-
Methods inherited from class org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider
close, getFetchConfiguration, getResult, getSelect, getStore, handleCheckedException, reset, setSize, size, supportsRandomAccess
-
-
-
-
Constructor Detail
-
PagingResultObjectProvider
public PagingResultObjectProvider(SelectExecutor sel, ClassMapping mapping, JDBCStore store, JDBCFetchConfiguration fetch, java.util.BitSet paged, long size)
Constructor.- Parameters:
sel- the select to executemapping- the mapping of the result objectsstore- the store manager to delegate loading tofetch- the fetch configuration, or null for defaultpaged- the bit set returned fromgetPagedFields(org.apache.openjpa.jdbc.sql.Select, org.apache.openjpa.jdbc.meta.ClassMapping, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration, int, long)size- the known maximum size of the result, orLong.MAX_VALUEfor no known limit
-
PagingResultObjectProvider
public PagingResultObjectProvider(SelectExecutor sel, ClassMapping[] mappings, JDBCStore store, JDBCFetchConfiguration fetch, java.util.BitSet[] paged, long size)
Constructor.- Parameters:
sel- the select to executemappings- the mappings for the independent classes of the result objectsstore- the store manager to delegate loading tofetch- the fetch configuration, or null for defaultpaged- the bit sets returned fromgetPagedFields(org.apache.openjpa.jdbc.sql.Select, org.apache.openjpa.jdbc.meta.ClassMapping, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration, int, long)for each select in the possible unionsize- the known maximum size of the result, orLong.MAX_VALUEfor no known limit
-
-
Method Detail
-
getPagedFields
public static java.util.BitSet getPagedFields(Select sel, ClassMapping mapping, JDBCStore store, JDBCFetchConfiguration fetch, int eagerMode, long size)
Return a bit set representing batch select fields that will be paged, or null if no fields need paging, which indicates that this provider should not be used.
-
getPageSize
public int getPageSize()
Return the page size in use.
-
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- Overrides:
openin classSelectResultObjectProvider- 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- Overrides:
nextin classSelectResultObjectProvider- 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- Overrides:
absolutein classSelectResultObjectProvider- Throws:
java.sql.SQLException
-
getResultObject
public java.lang.Object getResultObject() throws java.sql.SQLExceptionDescription copied from interface:ResultObjectProviderInstantiate the current result object. This method will only be called afterResultObjectProvider.next()orResultObjectProvider.absolute(int).- Throws:
java.sql.SQLException
-
-