Package org.apache.openjpa.jdbc.sql
Interface Result
- All Superinterfaces:
Closeable
- All Known Implementing Classes:
AbstractResult
,MergedResult
,ResultSetResult
,SelectImpl.SelectResult
A result from the execution of a query or stored procedure. This
interface is aligned closely with the
ResultSet
, so you
can expect like-named methods to have similar semantics. However, the
interface has been distilled and simplified, so a result object could
easily mask information sources other than a result set.
For more flexible customization of data loading, see the
PCResultObjectProvider
.- Author:
- Abe White
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
absolute
(int row) Move to the given 0-based row in the result, or return false if the row does not exist.void
close()
Free the resources used by this result; do not close the SQL connection.boolean
Return true if the given id or column is available in the result.boolean
Return true if the given column is available in the result.boolean
containsAll
(Object[] objs) Return true if all the given ids or columns are available in the result.boolean
containsAll
(Column[] cols, Joins joins) Return true if all the given columns are available in the result.void
Ends a data request.Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.getAsciiStream
(Object obj) Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.getAsciiStream
(Column col, Joins joins) Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.If this is the result of a UNION used to select a hierarchy of mappings, the base mapping represented by the current row.getBigDecimal
(Object obj) Return the value stored in the given column or id.getBigDecimal
(Column col, Joins joins) Return the value stored in the given column.getBigInteger
(Object obj) Return the value stored in the given column or id.getBigInteger
(Column col, Joins joins) Return the value stored in the given column.getBinaryStream
(Object obj) Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.getBinaryStream
(Column col, Joins joins) Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.boolean
getBoolean
(Object obj) Return the value stored in the given column or id.boolean
getBoolean
(Column col, Joins joins) Return the value stored in the given column.byte
Return the value stored in the given column or id.byte
Return the value stored in the given column.byte[]
Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.byte[]
Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.getCalendar
(Object obj) Return the value stored in the given column or id.getCalendar
(Column col, Joins joins) Return the value stored in the given column.char
Return the value stored in the given column or id.char
Return the value stored in the given column.getCharacterStream
(Object obj) Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.getCharacterStream
(Column col, Joins joins) Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.Return the value stored in the given column or id.Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.Return the value stored in the given column.double
Return the value stored in the given column or id.double
Return the value stored in the given column.getEager
(FieldMapping key) The eager result for the given key, or null if none.float
Return the value stored in the given column or id.float
Return the value stored in the given column.int
Return the value stored in the given column or id.int
Return the value stored in the given column.getLOBStream
(JDBCStore store, Object obj) getLocalDate
(Object obj) Return the value stored in the given column or id.getLocalDateTime
(Object obj) Return the value stored in the given column or id.Return the value stored in the given column or id.Return the value stored in the given column.getLocalTime
(Object obj) Return the value stored in the given column or id.long
Return the value stored in the given column or id.long
Return the value stored in the given column.If this is the result used to select a toMany relationship, the mappedByFieldMapping is field mapping representing the inverse relationship.If this is the result used to select a toMany relationship, the mappedByValue is value of the owner of the toMany relationship.Return the value stored in the given column or id.Return the value stored in the given column.Return the value stored in the given column or id.Return the value stored in the given column.getOffsetDateTime
(Object obj) Return the value stored in the given column or id.getOffsetTime
(Object obj) Return the value stored in the given column or id.Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.short
Return the value stored in the given column or id.short
Return the value stored in the given column.getSQLObject
(Object obj, Map map) Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.getSQLObject
(Column col, Map map, Joins joins) Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.Return the value stored in the given column or id.Return the value stored in the given column.Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.getTimestamp
(Object obj, Calendar cal) Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.getTimestamp
(Column col, Calendar cal, Joins joins) Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.int
indexOf()
The index of the select within the UNION that the current row corresponds to, or 0.boolean
If true, then any results loaded from this Result will be locked in the database.load
(ClassMapping mapping, JDBCStore store, JDBCFetchConfiguration fetch) Load a pc object using the given store manager.load
(ClassMapping mapping, JDBCStore store, JDBCFetchConfiguration fetch, Joins joins) Load a pc object using the given store manager.newJoins()
Return a new joins instance to use for traversing to related data.boolean
next()
Advance to the next row, or return false if there are no more rows in the result.void
pushBack()
Push back the last result.void
putEager
(FieldMapping key, Object res) The eager result for the given key, or null if none.void
setBaseMapping
(ClassMapping mapping) If this is the result of a UNION used to select a hierarchy of mappings, the base mapping represented by the current row.void
setLocking
(boolean locking) Set to true if row locking has been issued for the row.void
setMappedByFieldMapping
(FieldMapping fieldMapping) If this is the result used to select a toMany relationship, the mappedByFieldMapping is field mapping representing the inverse relationship.void
setMappedByValue
(Object mappedByValue) If this is the result used to select a toMany relationship, the mappedByValue is value of the owner of the toMany relationship.int
size()
Return the number of rows in this result.void
startDataRequest
(Object mapping) Informs this receiver about the application element for which a subsequent data request will be made.boolean
Return true if the result supports random access.boolean
wasNull()
Return true if the last value fetched was null.
-
Method Details
-
getEager
The eager result for the given key, or null if none. -
putEager
The eager result for the given key, or null if none. -
newJoins
Joins newJoins()Return a new joins instance to use for traversing to related data. -
close
void close()Free the resources used by this result; do not close the SQL connection. -
setLocking
void setLocking(boolean locking) Set to true if row locking has been issued for the row. -
isLocking
boolean isLocking()If true, then any results loaded from this Result will be locked in the database. -
supportsRandomAccess
Return true if the result supports random access.- Throws:
SQLException
-
absolute
Move to the given 0-based row in the result, or return false if the row does not exist. This method will only be called if the result supports random access.- Throws:
SQLException
-
next
Advance to the next row, or return false if there are no more rows in the result.- Throws:
SQLException
-
pushBack
Push back the last result. In other words, just ignore the next call tonext()
. After the first time this method is called, additional calls before a call tonext()
orabsolute(int)
should have no further affect.- Throws:
SQLException
-
size
Return the number of rows in this result.- Throws:
SQLException
-
contains
Return true if the given id or column is available in the result.- Throws:
SQLException
-
containsAll
Return true if all the given ids or columns are available in the result.- Throws:
SQLException
-
contains
Return true if the given column is available in the result.- Throws:
SQLException
-
containsAll
Return true if all the given columns are available in the result.- Throws:
SQLException
-
getBaseMapping
ClassMapping getBaseMapping()If this is the result of a UNION used to select a hierarchy of mappings, the base mapping represented by the current row. This information is not available after getting any eager results from the row. -
setBaseMapping
If this is the result of a UNION used to select a hierarchy of mappings, the base mapping represented by the current row. This information is not available after getting any eager results from the row. -
getMappedByFieldMapping
FieldMapping getMappedByFieldMapping()If this is the result used to select a toMany relationship, the mappedByFieldMapping is field mapping representing the inverse relationship. This is to avoid unneeded extra sql to retrieve the eager inverse field. -
setMappedByFieldMapping
If this is the result used to select a toMany relationship, the mappedByFieldMapping is field mapping representing the inverse relationship. This is to avoid unneeded extra sql to retrieve the eager inverse field. -
getMappedByValue
Object getMappedByValue()If this is the result used to select a toMany relationship, the mappedByValue is value of the owner of the toMany relationship. This is to avoid unneeded extra sql to retrieve the eager inverse field. -
setMappedByValue
If this is the result used to select a toMany relationship, the mappedByValue is value of the owner of the toMany relationship. This is to avoid unneeded extra sql to retrieve the eager inverse field. -
indexOf
int indexOf()The index of the select within the UNION that the current row corresponds to, or 0. -
load
Object load(ClassMapping mapping, JDBCStore store, JDBCFetchConfiguration fetch) throws SQLException Load a pc object using the given store manager.- Throws:
SQLException
-
load
Object load(ClassMapping mapping, JDBCStore store, JDBCFetchConfiguration fetch, Joins joins) throws SQLException Load a pc object using the given store manager.- Throws:
SQLException
-
getArray
Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getAsciiStream
Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getBigDecimal
Return the value stored in the given column or id.- Throws:
SQLException
-
getBigInteger
Return the value stored in the given column or id.- Throws:
SQLException
-
getBinaryStream
Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getLOBStream
- Throws:
SQLException
-
getBlob
Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getBoolean
Return the value stored in the given column or id.- Throws:
SQLException
-
getByte
Return the value stored in the given column or id.- Throws:
SQLException
-
getBytes
Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getCalendar
Return the value stored in the given column or id.- Throws:
SQLException
-
getLocalDate
Return the value stored in the given column or id.- Throws:
SQLException
-
getLocalTime
Return the value stored in the given column or id.- Throws:
SQLException
-
getLocalDateTime
Return the value stored in the given column or id.- Throws:
SQLException
-
getOffsetTime
Return the value stored in the given column or id.- Throws:
SQLException
-
getOffsetDateTime
Return the value stored in the given column or id.- Throws:
SQLException
-
getChar
Return the value stored in the given column or id.- Throws:
SQLException
-
getCharacterStream
Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getClob
Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getDate
Return the value stored in the given column or id.- Throws:
SQLException
-
getDate
Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getDouble
Return the value stored in the given column or id.- Throws:
SQLException
-
getFloat
Return the value stored in the given column or id.- Throws:
SQLException
-
getInt
Return the value stored in the given column or id.- Throws:
SQLException
-
getLocale
Return the value stored in the given column or id.- Throws:
SQLException
-
getLong
Return the value stored in the given column or id.- Throws:
SQLException
-
getNumber
Return the value stored in the given column or id.- Throws:
SQLException
-
getObject
Return the value stored in the given column or id.- Parameters:
obj
- the column or id whose data to fetchmetaType
- the type code fromJavaTypes
orJavaSQLTypes
for the type of the data; ifobj
is a column, you may specify -1 to use the column's recorded java typearg
- some JDBC data access methods use an argument, such as aCalendar
orMap
- Throws:
SQLException
-
getSQLObject
Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getRef
Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getShort
Return the value stored in the given column or id.- Throws:
SQLException
-
getString
Return the value stored in the given column or id.- Throws:
SQLException
-
getTime
Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getTimestamp
Return the value stored in the given column or id; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getArray
Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getAsciiStream
Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getBigDecimal
Return the value stored in the given column.- Throws:
SQLException
-
getBigInteger
Return the value stored in the given column.- Throws:
SQLException
-
getBinaryStream
Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getBlob
Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getBoolean
Return the value stored in the given column.- Throws:
SQLException
-
getByte
Return the value stored in the given column.- Throws:
SQLException
-
getBytes
Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getCalendar
Return the value stored in the given column.- Throws:
SQLException
-
getChar
Return the value stored in the given column.- Throws:
SQLException
-
getCharacterStream
Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getClob
Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getDate
Return the value stored in the given column.- Throws:
SQLException
-
getDate
Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getDouble
Return the value stored in the given column.- Throws:
SQLException
-
getFloat
Return the value stored in the given column.- Throws:
SQLException
-
getInt
Return the value stored in the given column.- Throws:
SQLException
-
getLocale
Return the value stored in the given column.- Throws:
SQLException
-
getLong
Return the value stored in the given column.- Throws:
SQLException
-
getNumber
Return the value stored in the given column.- Throws:
SQLException
-
getObject
Return the value stored in the given column.- Parameters:
col
- the column whose data to fetcharg
- some JDBC data access methods use an argument, such as aCalendar
orMap
- Throws:
SQLException
-
getSQLObject
Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getRef
Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getShort
Return the value stored in the given column.- Throws:
SQLException
-
getString
Return the value stored in the given column.- Throws:
SQLException
-
getTime
Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
getTimestamp
Return the value stored in the given column; may not be supported by results that are not backed by a SQL result set.- Throws:
SQLException
-
wasNull
Return true if the last value fetched was null.- Throws:
SQLException
-
startDataRequest
Informs this receiver about the application element for which a subsequent data request will be made. -
endDataRequest
void endDataRequest()Ends a data request. Must be called in conjunction withstartDataRequest(java.lang.Object)
. The calls can be nested as follws
startDataRequest (relation); startDataRequest (relationsField); getObject("COLUMN_Y"); endDataRequest (); endDataRequest ();
-