Search in sources :

Example 1 with DefaultCursor

use of org.apache.ibatis.cursor.defaults.DefaultCursor in project mybatis-3 by mybatis.

the class DefaultResultSetHandler method handleCursorResultSets.

@Override
public <E> Cursor<E> handleCursorResultSets(Statement stmt) throws SQLException {
    ErrorContext.instance().activity("handling cursor results").object(mappedStatement.getId());
    ResultSetWrapper rsw = getFirstResultSet(stmt);
    List<ResultMap> resultMaps = mappedStatement.getResultMaps();
    int resultMapCount = resultMaps.size();
    validateResultMapsCount(rsw, resultMapCount);
    if (resultMapCount != 1) {
        throw new ExecutorException("Cursor results cannot be mapped to multiple resultMaps");
    }
    ResultMap resultMap = resultMaps.get(0);
    return new DefaultCursor<E>(this, resultMap, rsw, rowBounds);
}
Also used : ResultMap(org.apache.ibatis.mapping.ResultMap) ExecutorException(org.apache.ibatis.executor.ExecutorException) DefaultCursor(org.apache.ibatis.cursor.defaults.DefaultCursor)

Aggregations

DefaultCursor (org.apache.ibatis.cursor.defaults.DefaultCursor)1 ExecutorException (org.apache.ibatis.executor.ExecutorException)1 ResultMap (org.apache.ibatis.mapping.ResultMap)1