public <U> U forStream(
            String fileName,
            Object entity,
            Function<? super Stream<Map<String, Object>>, U> handleStream) {
        String sql = getTemplate(fileName, entity);
        RowMapper<Map<String, Object>> mapper = new ColumnMapRowMapper();
        if (TypeUtils.isSimpleValueType(entity.getClass())) {
            PreparedStatementSetter pss = paramBuilder.byArgs(entity);
            return queryStreamWithOrdinalParams(sql, pss, mapper, handleStream);
        } else {
            SqlParameterSource sps = paramBuilder.byBean(entity);
            return queryStreamWithNamedParams(sql, sps, mapper, handleStream);
        }
    }
public <U> U forStream(
            String fileName,
            Object entity,
            Function<? super Stream<Map<String, Object>>, U> handleStream) {
        String sql = getTemplate(fileName, entity);
        RowMapper<Map<String, Object>> mapper = new ColumnMapRowMapper();
        if (TypeUtils.isSimpleValueType(entity.getClass())) {
            PreparedStatementSetter pss = paramBuilder.byArgs(entity);
            return queryStreamWithOrdinalParams(sql, pss, mapper, handleStream);
        } else {
            SqlParameterSource sps = paramBuilder.byBean(entity);
            return queryStreamWithNamedParams(sql, sps, mapper, handleStream);
        }
    }
public < U > U forStream ( String fileName , Object entity , Function < ? super Stream < Map < String , Object > > , U > handleStream ) { String sql = getTemplate ( fileName , entity ) ; RowMapper < Map < String , Object > > mapper = new ColumnMapRowMapper ( ) ; if ( TypeUtils . isSimpleValueType ( entity . getClass ( ) ) ) { PreparedStatementSetter pss = paramBuilder . byArgs ( entity ) ; return queryStreamWithOrdinalParams ( sql , pss , mapper , handleStream ) ; } else { SqlParameterSource sps = paramBuilder . byBean ( entity ) ; return queryStreamWithNamedParams ( sql , sps , mapper , handleStream ) ; } }
Executes a query, passing the column maps to {@code handleStream} as a stream.

<p>{@code entity} is used as the single parameter if it is a simple value,
or as the container of the named parameters if it is a bean.</p>

<p>Example usage with a simple value parameter:</p>

<pre>
int totalSalary = sqlTemplate.forStream("/path/to/query.sql", "SALESMAN",
mapStream -&gt; mapStream.mapToInt(map -&gt; (Integer) map.get("salary")).sum());
</pre>

<p>Example usage with a bean parameter:</p>

<pre>
emp.setDeptno(30);
emp.setJob("SALESMAN");
int totalSalary = sqlTemplate.forStream("/path/to/query.sql", emp,
mapStream -&gt; mapStream.mapToInt(map -&gt; (Integer) map.get("salary")).sum());
</pre>

@param fileName parameterized SQL specifier
@param entity the single parameter or the container of the named parameters
@param handleStream  the function which is applied to the stream
@param <U> the result type
@return the result of {@code handleStream}
@throws org.springframework.dao.DataAccessException if there is any problem
Executes a query passing the column maps to { @code handleStream } as a stream .