Package org.apache.openjpa.jdbc.sql
Interface Result
-
- All Superinterfaces:
Closeable
- All Known Implementing Classes:
AbstractResult,MergedResult,ResultSetResult,SelectImpl.SelectResult
public interface Result extends Closeable
A result from the execution of a query or stored procedure. This interface is aligned closely with theResultSet, 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 thePCResultObjectProvider.- Author:
- Abe White
- See Also:
ResultSetResult
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanabsolute(int row)Move to the given 0-based row in the result, or return false if the row does not exist.voidclose()Free the resources used by this result; do not close the SQL connection.booleancontains(Object obj)Return true if the given id or column is available in the result.booleancontains(Column col, Joins joins)Return true if the given column is available in the result.booleancontainsAll(Object[] objs)Return true if all the given ids or columns are available in the result.booleancontainsAll(Column[] cols, Joins joins)Return true if all the given columns are available in the result.voidendDataRequest()Ends a data request.ArraygetArray(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.ArraygetArray(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.InputStreamgetAsciiStream(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.InputStreamgetAsciiStream(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.ClassMappinggetBaseMapping()If this is the result of a UNION used to select a hierarchy of mappings, the base mapping represented by the current row.BigDecimalgetBigDecimal(Object obj)Return the value stored in the given column or id.BigDecimalgetBigDecimal(Column col, Joins joins)Return the value stored in the given column.BigIntegergetBigInteger(Object obj)Return the value stored in the given column or id.BigIntegergetBigInteger(Column col, Joins joins)Return the value stored in the given column.InputStreamgetBinaryStream(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.InputStreamgetBinaryStream(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.BlobgetBlob(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.BlobgetBlob(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.booleangetBoolean(Object obj)Return the value stored in the given column or id.booleangetBoolean(Column col, Joins joins)Return the value stored in the given column.bytegetByte(Object obj)Return the value stored in the given column or id.bytegetByte(Column col, Joins joins)Return the value stored in the given column.byte[]getBytes(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.byte[]getBytes(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.CalendargetCalendar(Object obj)Return the value stored in the given column or id.CalendargetCalendar(Column col, Joins joins)Return the value stored in the given column.chargetChar(Object obj)Return the value stored in the given column or id.chargetChar(Column col, Joins joins)Return the value stored in the given column.ReadergetCharacterStream(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.ReadergetCharacterStream(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.ClobgetClob(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.ClobgetClob(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.DategetDate(Object obj)Return the value stored in the given column or id.DategetDate(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.DategetDate(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.DategetDate(Column col, Joins joins)Return the value stored in the given column.doublegetDouble(Object obj)Return the value stored in the given column or id.doublegetDouble(Column col, Joins joins)Return the value stored in the given column.ObjectgetEager(FieldMapping key)The eager result for the given key, or null if none.floatgetFloat(Object obj)Return the value stored in the given column or id.floatgetFloat(Column col, Joins joins)Return the value stored in the given column.intgetInt(Object obj)Return the value stored in the given column or id.intgetInt(Column col, Joins joins)Return the value stored in the given column.InputStreamgetLOBStream(JDBCStore store, Object obj)LocalDategetLocalDate(Object obj)Return the value stored in the given column or id.LocalDateTimegetLocalDateTime(Object obj)Return the value stored in the given column or id.LocalegetLocale(Object obj)Return the value stored in the given column or id.LocalegetLocale(Column col, Joins joins)Return the value stored in the given column.LocalTimegetLocalTime(Object obj)Return the value stored in the given column or id.longgetLong(Object obj)Return the value stored in the given column or id.longgetLong(Column col, Joins joins)Return the value stored in the given column.FieldMappinggetMappedByFieldMapping()If this is the result used to select a toMany relationship, the mappedByFieldMapping is field mapping representing the inverse relationship.ObjectgetMappedByValue()If this is the result used to select a toMany relationship, the mappedByValue is value of the owner of the toMany relationship.NumbergetNumber(Object obj)Return the value stored in the given column or id.NumbergetNumber(Column col, Joins joins)Return the value stored in the given column.ObjectgetObject(Object obj, int metaType, Object arg)Return the value stored in the given column or id.ObjectgetObject(Column col, Object arg, Joins joins)Return the value stored in the given column.OffsetDateTimegetOffsetDateTime(Object obj)Return the value stored in the given column or id.OffsetTimegetOffsetTime(Object obj)Return the value stored in the given column or id.RefgetRef(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.RefgetRef(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.shortgetShort(Object obj)Return the value stored in the given column or id.shortgetShort(Column col, Joins joins)Return the value stored in the given column.ObjectgetSQLObject(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.ObjectgetSQLObject(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.StringgetString(Object obj)Return the value stored in the given column or id.StringgetString(Column col, Joins joins)Return the value stored in the given column.TimegetTime(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.TimegetTime(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.TimestampgetTimestamp(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.TimestampgetTimestamp(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.intindexOf()The index of the select within the UNION that the current row corresponds to, or 0.booleanisLocking()If true, then any results loaded from this Result will be locked in the database.Objectload(ClassMapping mapping, JDBCStore store, JDBCFetchConfiguration fetch)Load a pc object using the given store manager.Objectload(ClassMapping mapping, JDBCStore store, JDBCFetchConfiguration fetch, Joins joins)Load a pc object using the given store manager.JoinsnewJoins()Return a new joins instance to use for traversing to related data.booleannext()Advance to the next row, or return false if there are no more rows in the result.voidpushBack()Push back the last result.voidputEager(FieldMapping key, Object res)The eager result for the given key, or null if none.voidsetBaseMapping(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.voidsetLocking(boolean locking)Set to true if row locking has been issued for the row.voidsetMappedByFieldMapping(FieldMapping fieldMapping)If this is the result used to select a toMany relationship, the mappedByFieldMapping is field mapping representing the inverse relationship.voidsetMappedByValue(Object mappedByValue)If this is the result used to select a toMany relationship, the mappedByValue is value of the owner of the toMany relationship.intsize()Return the number of rows in this result.voidstartDataRequest(Object mapping)Informs this receiver about the application element for which a subsequent data request will be made.booleansupportsRandomAccess()Return true if the result supports random access.booleanwasNull()Return true if the last value fetched was null.
-
-
-
Method Detail
-
getEager
Object getEager(FieldMapping key)
The eager result for the given key, or null if none.
-
putEager
void putEager(FieldMapping key, Object res)
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
boolean supportsRandomAccess() throws SQLExceptionReturn true if the result supports random access.- Throws:
SQLException
-
absolute
boolean absolute(int row) throws SQLExceptionMove 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
boolean next() throws SQLExceptionAdvance to the next row, or return false if there are no more rows in the result.- Throws:
SQLException
-
pushBack
void pushBack() throws SQLExceptionPush 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
int size() throws SQLException
Return the number of rows in this result.- Throws:
SQLException
-
contains
boolean contains(Object obj) throws SQLException
Return true if the given id or column is available in the result.- Throws:
SQLException
-
containsAll
boolean containsAll(Object[] objs) throws SQLException
Return true if all the given ids or columns are available in the result.- Throws:
SQLException
-
contains
boolean contains(Column col, Joins joins) throws SQLException
Return true if the given column is available in the result.- Throws:
SQLException
-
containsAll
boolean containsAll(Column[] cols, Joins joins) throws SQLException
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
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. 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
void setMappedByFieldMapping(FieldMapping fieldMapping)
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
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. 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
Array getArray(Object obj) throws SQLException
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
InputStream getAsciiStream(Object obj) throws SQLException
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
BigDecimal getBigDecimal(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getBigInteger
BigInteger getBigInteger(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getBinaryStream
InputStream getBinaryStream(Object obj) throws SQLException
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
InputStream getLOBStream(JDBCStore store, Object obj) throws SQLException
- Throws:
SQLException
-
getBlob
Blob getBlob(Object obj) throws SQLException
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
boolean getBoolean(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getByte
byte getByte(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getBytes
byte[] getBytes(Object obj) throws SQLException
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
Calendar getCalendar(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getLocalDate
LocalDate getLocalDate(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getLocalTime
LocalTime getLocalTime(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getLocalDateTime
LocalDateTime getLocalDateTime(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getOffsetTime
OffsetTime getOffsetTime(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getOffsetDateTime
OffsetDateTime getOffsetDateTime(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getChar
char getChar(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getCharacterStream
Reader getCharacterStream(Object obj) throws SQLException
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
Clob getClob(Object obj) throws SQLException
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
Date getDate(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getDate
Date getDate(Object obj, Calendar cal) throws SQLException
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
double getDouble(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getFloat
float getFloat(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getInt
int getInt(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getLocale
Locale getLocale(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getLong
long getLong(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getNumber
Number getNumber(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getObject
Object getObject(Object obj, int metaType, Object arg) throws SQLException
Return the value stored in the given column or id.- Parameters:
obj- the column or id whose data to fetchmetaType- the type code fromJavaTypesorJavaSQLTypesfor the type of the data; ifobjis a column, you may specify -1 to use the column's recorded java typearg- some JDBC data access methods use an argument, such as aCalendarorMap- Throws:
SQLException
-
getSQLObject
Object getSQLObject(Object obj, Map map) throws SQLException
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
Ref getRef(Object obj, Map map) throws SQLException
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
short getShort(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getString
String getString(Object obj) throws SQLException
Return the value stored in the given column or id.- Throws:
SQLException
-
getTime
Time getTime(Object obj, Calendar cal) throws SQLException
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
Timestamp getTimestamp(Object obj, Calendar cal) throws SQLException
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
Array getArray(Column col, Joins joins) throws SQLException
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
InputStream getAsciiStream(Column col, Joins joins) throws SQLException
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
BigDecimal getBigDecimal(Column col, Joins joins) throws SQLException
Return the value stored in the given column.- Throws:
SQLException
-
getBigInteger
BigInteger getBigInteger(Column col, Joins joins) throws SQLException
Return the value stored in the given column.- Throws:
SQLException
-
getBinaryStream
InputStream getBinaryStream(Column col, Joins joins) throws SQLException
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
Blob getBlob(Column col, Joins joins) throws SQLException
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
boolean getBoolean(Column col, Joins joins) throws SQLException
Return the value stored in the given column.- Throws:
SQLException
-
getByte
byte getByte(Column col, Joins joins) throws SQLException
Return the value stored in the given column.- Throws:
SQLException
-
getBytes
byte[] getBytes(Column col, Joins joins) throws SQLException
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
Calendar getCalendar(Column col, Joins joins) throws SQLException
Return the value stored in the given column.- Throws:
SQLException
-
getChar
char getChar(Column col, Joins joins) throws SQLException
Return the value stored in the given column.- Throws:
SQLException
-
getCharacterStream
Reader getCharacterStream(Column col, Joins joins) throws SQLException
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
Clob getClob(Column col, Joins joins) throws SQLException
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
Date getDate(Column col, Joins joins) throws SQLException
Return the value stored in the given column.- Throws:
SQLException
-
getDate
Date getDate(Column col, Calendar cal, Joins joins) throws SQLException
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
double getDouble(Column col, Joins joins) throws SQLException
Return the value stored in the given column.- Throws:
SQLException
-
getFloat
float getFloat(Column col, Joins joins) throws SQLException
Return the value stored in the given column.- Throws:
SQLException
-
getInt
int getInt(Column col, Joins joins) throws SQLException
Return the value stored in the given column.- Throws:
SQLException
-
getLocale
Locale getLocale(Column col, Joins joins) throws SQLException
Return the value stored in the given column.- Throws:
SQLException
-
getLong
long getLong(Column col, Joins joins) throws SQLException
Return the value stored in the given column.- Throws:
SQLException
-
getNumber
Number getNumber(Column col, Joins joins) throws SQLException
Return the value stored in the given column.- Throws:
SQLException
-
getObject
Object getObject(Column col, Object arg, Joins joins) throws SQLException
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 aCalendarorMap- Throws:
SQLException
-
getSQLObject
Object getSQLObject(Column col, Map map, Joins joins) throws SQLException
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
Ref getRef(Column col, Map map, Joins joins) throws SQLException
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
short getShort(Column col, Joins joins) throws SQLException
Return the value stored in the given column.- Throws:
SQLException
-
getString
String getString(Column col, Joins joins) throws SQLException
Return the value stored in the given column.- Throws:
SQLException
-
getTime
Time getTime(Column col, Calendar cal, Joins joins) throws SQLException
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
Timestamp getTimestamp(Column col, Calendar cal, Joins joins) throws SQLException
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
boolean wasNull() throws SQLExceptionReturn true if the last value fetched was null.- Throws:
SQLException
-
startDataRequest
void startDataRequest(Object mapping)
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 ();
-
-