Package org.apache.openjpa.jdbc.kernel
Class XROP
- java.lang.Object
-
- org.apache.openjpa.jdbc.kernel.XROP
-
- All Implemented Interfaces:
BatchedResultObjectProvider
,ResultObjectProvider
,Closeable
public class XROP extends java.lang.Object implements BatchedResultObjectProvider
Gets multiple Result Object Providers each with different mapping.- Author:
- Pinaki Poddar
-
-
Constructor Summary
Constructors Constructor Description XROP(java.util.List<QueryResultMapping> mappings, java.util.List<java.lang.Class<?>> classes, JDBCStore store, JDBCFetchConfiguration fetch, java.sql.CallableStatement stmt)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
absolute(int pos)
Returns false.void
close()
Closes the underlying statement.boolean
getExecutionResult()
Gets the result of executing the underlying JDBC statement.java.lang.Object
getOut(int position)
java.lang.Object
getOut(java.lang.String name)
ResultObjectProvider
getResultObject()
Gets the current result set, wraps it with aResultSetResult
, then wraps again with appropriate ROP based on the result set mapping.int
getUpdateCount()
Gets the update count, provided the current result of the statement is not a result set.void
handleCheckedException(java.lang.Exception e)
Any checked exceptions that are thrown will be passed to this method.boolean
hasMoreResults()
Affirms if more result sets are available.boolean
next()
Throws exception.void
open()
Opens this provider by executing the underlying Statment.void
reset()
Throws exception.int
size()
Returns-1
.boolean
supportsRandomAccess()
Does not support random access.
-
-
-
Constructor Detail
-
XROP
public XROP(java.util.List<QueryResultMapping> mappings, java.util.List<java.lang.Class<?>> classes, JDBCStore store, JDBCFetchConfiguration fetch, java.sql.CallableStatement stmt)
-
-
Method Detail
-
supportsRandomAccess
public boolean supportsRandomAccess()
Does not support random access.- Specified by:
supportsRandomAccess
in interfaceResultObjectProvider
-
open
public void open() throws java.lang.Exception
Opens this provider by executing the underlying Statment. The result of execution is memorized.- Specified by:
open
in interfaceResultObjectProvider
- Throws:
java.lang.Exception
-
getResultObject
public ResultObjectProvider getResultObject() throws java.lang.Exception
Gets the current result set, wraps it with aResultSetResult
, then wraps again with appropriate ROP based on the result set mapping.
The ResultSet and the associated connection must not be closed.- Specified by:
getResultObject
in interfaceBatchedResultObjectProvider
- Specified by:
getResultObject
in interfaceResultObjectProvider
- Returns:
- a provider or null if the underlying statement has no more results.
- Throws:
java.lang.Exception
-
close
public void close() throws java.lang.Exception
Closes the underlying statement.- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceResultObjectProvider
- Throws:
java.lang.Exception
-
hasMoreResults
public boolean hasMoreResults()
Affirms if more result sets are available.
: The side effect is to advance to the statement's next result. - Specified by:
hasMoreResults
in interfaceBatchedResultObjectProvider
-
getExecutionResult
public boolean getExecutionResult()
Description copied from interface:BatchedResultObjectProvider
Gets the result of executing the underlying JDBC statement.- Specified by:
getExecutionResult
in interfaceBatchedResultObjectProvider
- Returns:
- a boolean value whose semantics is same as
PreparedStatement.execute()
.
-
getUpdateCount
public int getUpdateCount()
Gets the update count, provided the current result of the statement is not a result set.- Specified by:
getUpdateCount
in interfaceBatchedResultObjectProvider
- Returns:
- an integer value whose semantics is same as
Statement.getUpdateCount()
.
-
getOut
public java.lang.Object getOut(java.lang.String name)
- Specified by:
getOut
in interfaceBatchedResultObjectProvider
-
getOut
public java.lang.Object getOut(int position)
- Specified by:
getOut
in interfaceBatchedResultObjectProvider
-
next
public boolean next() throws java.lang.Exception
Throws exception.- Specified by:
next
in interfaceResultObjectProvider
- Throws:
java.lang.Exception
-
absolute
public boolean absolute(int pos) throws java.lang.Exception
Returns false.- Specified by:
absolute
in interfaceResultObjectProvider
- Throws:
java.lang.Exception
-
size
public int size() throws java.lang.Exception
Returns-1
.- Specified by:
size
in interfaceResultObjectProvider
- Throws:
java.lang.Exception
-
reset
public void reset() throws java.lang.Exception
Throws exception.- Specified by:
reset
in interfaceResultObjectProvider
- Throws:
java.lang.Exception
-
handleCheckedException
public void handleCheckedException(java.lang.Exception e)
Description copied from interface:ResultObjectProvider
Any 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:
handleCheckedException
in interfaceResultObjectProvider
-
-