Class AbstractLobStreamingResultSetExtractor<T>

  • java.lang.Object
  • Type Parameters:
    T - the result type
    All Implemented Interfaces:

    public abstract class AbstractLobStreamingResultSetExtractor<T>
    extends java.lang.Object
    implements ResultSetExtractor<T>
    Abstract ResultSetExtractor implementation that assumes streaming of LOB data. Typically used as inner class, with access to surrounding method arguments.

    Delegates to the streamData template method for streaming LOB content to some OutputStream, typically using a LobHandler. Converts an IOException thrown during streaming to a LobRetrievalFailureException.

    A usage example with JdbcTemplate:

    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);  // reusable object
     final LobHandler lobHandler = new DefaultLobHandler();  // reusable object
                     "SELECT content FROM imagedb WHERE image_name=?", new Object[] {name},
                     new AbstractLobStreamingResultSetExtractor() {
                             public void streamData(ResultSet rs) throws SQLException, IOException {
                                     FileCopyUtils.copy(lobHandler.getBlobAsBinaryStream(rs, 1), contentStream);
    Juergen Hoeller
    See Also:
    LobHandler, LobRetrievalFailureException
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      T extractData(java.sql.ResultSet rs)
      Delegates to handleNoRowFound, handleMultipleRowsFound and streamData, according to the ResultSet state.
      protected void handleMultipleRowsFound()
      Handle the case where the ResultSet contains multiple rows.
      protected void handleNoRowFound()
      Handle the case where the ResultSet does not contain a row.
      protected abstract void streamData(java.sql.ResultSet rs)
      Stream LOB content from the given ResultSet to some OutputStream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractLobStreamingResultSetExtractor

        public AbstractLobStreamingResultSetExtractor()