Class ResultSetWrappingSqlRowSet

  • All Implemented Interfaces:
    Serializable, SqlRowSet

    public class ResultSetWrappingSqlRowSet
    extends Object
    implements SqlRowSet
    The default implementation of Spring's SqlRowSet interface, wrapping a ResultSet, catching any SQLExceptions and translating them to a corresponding Spring InvalidResultSetAccessException.

    The passed-in ResultSet should already be disconnected if the SqlRowSet is supposed to be usable in a disconnected fashion. This means that you will usually pass in a javax.sql.rowset.CachedRowSet, which implements the ResultSet interface.

    Note: Since JDBC 4.0, it has been clarified that any methods using a String to identify the column should be using the column label. The column label is assigned using the ALIAS keyword in the SQL query string. When the query doesn't use an ALIAS, the default label is the column name. Most JDBC ResultSet implementations follow this new pattern but there are exceptions such as the com.sun.rowset.CachedRowSetImpl class which only uses the column name, ignoring any column labels. As of Spring 3.0.5, ResultSetWrappingSqlRowSet will translate column labels to the correct column index to provide better support for the com.sun.rowset.CachedRowSetImpl which is the default implementation used by JdbcTemplate when working with RowSets.

    Note: This class implements the java.io.Serializable marker interface through the SqlRowSet interface, but is only actually serializable if the disconnected ResultSet/RowSet contained in it is serializable. Most CachedRowSet implementations are actually serializable, so this should usually work out.

    Since:
    1.2
    Author:
    Thomas Risberg, Juergen Hoeller
    See Also:
    ResultSet, CachedRowSet, JdbcTemplate.queryForRowSet(java.lang.String), Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleanabsolute​(int row)
      Move the cursor to the given row number in the row set, just after the last row.
      voidafterLast()
      Move the cursor to the end of this row set.
      voidbeforeFirst()
      Move the cursor to the front of this row set, just before the first row.
      intfindColumn​(String columnLabel)
      Map the given column label to its column index.
      booleanfirst()
      Move the cursor to the first row of this row set.
      BigDecimalgetBigDecimal​(int columnIndex)
      Retrieve the value of the indicated column in the current row as a BigDecimal object.
      BigDecimalgetBigDecimal​(String columnLabel)
      Retrieve the value of the indicated column in the current row as a BigDecimal object.
      booleangetBoolean​(int columnIndex)
      Retrieve the value of the indicated column in the current row as a boolean.
      booleangetBoolean​(String columnLabel)
      Retrieve the value of the indicated column in the current row as a boolean.
      bytegetByte​(int columnIndex)
      Retrieve the value of the indicated column in the current row as a byte.
      bytegetByte​(String columnLabel)
      Retrieve the value of the indicated column in the current row as a byte.
      DategetDate​(int columnIndex)
      Retrieve the value of the indicated column in the current row as a Date object.
      DategetDate​(int columnIndex, Calendar cal)
      Retrieve the value of the indicated column in the current row as a Date object.
      DategetDate​(String columnLabel)
      Retrieve the value of the indicated column in the current row as a Date object.
      DategetDate​(String columnLabel, Calendar cal)
      Retrieve the value of the indicated column in the current row as a Date object.
      doublegetDouble​(int columnIndex)
      Retrieve the value of the indicated column in the current row as a Double object.
      doublegetDouble​(String columnLabel)
      Retrieve the value of the indicated column in the current row as a Double object.
      floatgetFloat​(int columnIndex)
      Retrieve the value of the indicated column in the current row as a float.
      floatgetFloat​(String columnLabel)
      Retrieve the value of the indicated column in the current row as a float.
      intgetInt​(int columnIndex)
      Retrieve the value of the indicated column in the current row as an int.
      intgetInt​(String columnLabel)
      Retrieve the value of the indicated column in the current row as an int.
      longgetLong​(int columnIndex)
      Retrieve the value of the indicated column in the current row as a long.
      longgetLong​(String columnLabel)
      Retrieve the value of the indicated column in the current row as a long.
      SqlRowSetMetaDatagetMetaData()
      Retrieve the meta-data, i.e.
      StringgetNString​(int columnIndex)
      Retrieve the value of the indicated column in the current row as a String (for NCHAR, NVARCHAR, LONGNVARCHAR columns).
      StringgetNString​(String columnLabel)
      Retrieve the value of the indicated column in the current row as a String (for NCHAR, NVARCHAR, LONGNVARCHAR columns).
      ObjectgetObject​(int columnIndex)
      Retrieve the value of the indicated column in the current row as an Object.
      <T> TgetObject​(int columnIndex, Class<T> type)
      Retrieve the value of the indicated column in the current row as an Object.
      ObjectgetObject​(int columnIndex, Map<String,​Class<?>> map)
      Retrieve the value of the indicated column in the current row as an Object.
      ObjectgetObject​(String columnLabel)
      Retrieve the value of the indicated column in the current row as an Object.
      <T> TgetObject​(String columnLabel, Class<T> type)
      Retrieve the value of the indicated column in the current row as an Object.
      ObjectgetObject​(String columnLabel, Map<String,​Class<?>> map)
      Retrieve the value of the indicated column in the current row as an Object.
      ResultSetgetResultSet()
      Return the underlying ResultSet (usually a javax.sql.rowset.CachedRowSet).
      intgetRow()
      Retrieve the current row number.
      shortgetShort​(int columnIndex)
      Retrieve the value of the indicated column in the current row as a short.
      shortgetShort​(String columnLabel)
      Retrieve the value of the indicated column in the current row as a short.
      StringgetString​(int columnIndex)
      Retrieve the value of the indicated column in the current row as a String.
      StringgetString​(String columnLabel)
      Retrieve the value of the indicated column in the current row as a String.
      TimegetTime​(int columnIndex)
      Retrieve the value of the indicated column in the current row as a Time object.
      TimegetTime​(int columnIndex, Calendar cal)
      Retrieve the value of the indicated column in the current row as a Time object.
      TimegetTime​(String columnLabel)
      Retrieve the value of the indicated column in the current row as a Time object.
      TimegetTime​(String columnLabel, Calendar cal)
      Retrieve the value of the indicated column in the current row as a Time object.
      TimestampgetTimestamp​(int columnIndex)
      Retrieve the value of the indicated column in the current row as a Timestamp object.
      TimestampgetTimestamp​(int columnIndex, Calendar cal)
      Retrieve the value of the indicated column in the current row as a Timestamp object.
      TimestampgetTimestamp​(String columnLabel)
      Retrieve the value of the indicated column in the current row as a Timestamp object.
      TimestampgetTimestamp​(String columnLabel, Calendar cal)
      Retrieve the value of the indicated column in the current row as a Timestamp object.
      booleanisAfterLast()
      Retrieve whether the cursor is after the last row of this row set.
      booleanisBeforeFirst()
      Retrieve whether the cursor is before the first row of this row set.
      booleanisFirst()
      Retrieve whether the cursor is on the first row of this row set.
      booleanisLast()
      Retrieve whether the cursor is on the last row of this row set.
      booleanlast()
      Move the cursor to the last row of this row set.
      booleannext()
      Move the cursor to the next row.
      booleanprevious()
      Move the cursor to the previous row.
      booleanrelative​(int rows)
      Move the cursor a relative number of rows, either positive or negative.
      booleanwasNull()
      Report whether the last column read had a value of SQL NULL.