Examples of RowHandler


Examples of com.ibatis.sqlmap.client.event.RowHandler

    assertEquals(result, template.queryForList("myStatement", "myParameter", 10, 20));
    template.executorControl.verify();
  }

  public void testQueryWithRowHandler() throws SQLException {
    RowHandler rowHandler = new TestRowHandler();
    TestSqlMapClientTemplate template = new TestSqlMapClientTemplate();
    template.executor.queryWithRowHandler("myStatement", null, rowHandler);
    template.executorControl.setVoidCallable(1);
    template.executorControl.replay();
    template.queryWithRowHandler("myStatement", rowHandler);
View Full Code Here

Examples of com.ibatis.sqlmap.client.event.RowHandler

    template.queryWithRowHandler("myStatement", rowHandler);
    template.executorControl.verify();
  }

  public void testQueryWithRowHandlerWithParameter() throws SQLException {
    RowHandler rowHandler = new TestRowHandler();
    TestSqlMapClientTemplate template = new TestSqlMapClientTemplate();
    template.executor.queryWithRowHandler("myStatement", "myParameter", rowHandler);
    template.executorControl.setVoidCallable(1);
    template.executorControl.replay();
    template.queryWithRowHandler("myStatement", "myParameter", rowHandler);
View Full Code Here

Examples of com.ibatis.sqlmap.client.event.RowHandler

        Assert.assertEquals(1, wrapper.queryForList("User.select").size());
        Assert.assertEquals(1, wrapper.queryForList("User.select", Collections.emptyMap()).size());
        Assert.assertEquals(1, wrapper.queryForList("User.select", Collections.emptyMap(), 0, 2).size());

        wrapper.queryWithRowHandler("User.select", new RowHandler() {

            @Override
            public void handleRow(Object valueObject) {

            }
        });
        wrapper.queryWithRowHandler("User.select", Collections.emptyMap(), new RowHandler() {

            @Override
            public void handleRow(Object valueObject) {

            }
View Full Code Here

Examples of com.ibatis.sqlmap.client.event.RowHandler

        Assert.assertEquals(1, wrapper.queryForList("User.select").size());
        Assert.assertEquals(1, wrapper.queryForList("User.select", Collections.emptyMap()).size());
        Assert.assertEquals(1, wrapper.queryForList("User.select", Collections.emptyMap(), 0, 2).size());

        wrapper.queryWithRowHandler("User.select", new RowHandler() {

            @Override
            public void handleRow(Object valueObject) {

            }
        });
        wrapper.queryWithRowHandler("User.select", Collections.emptyMap(), new RowHandler() {

            @Override
            public void handleRow(Object valueObject) {

            }
View Full Code Here

Examples of net.paoding.rose.jade.annotation.RowHandler

    private Map<String, RowMapper> rowMappers = new HashMap<String, RowMapper>();

    @Override
    public RowMapper getRowMapper(StatementMetaData modifier) {
        RowHandler rowHandler = modifier.getAnnotation(RowHandler.class);
        if (rowHandler != null) {
            if (rowHandler.rowMapper() != RowHandler.ByDefault.class) {
                try {
                    RowMapper rowMapper = rowHandler.rowMapper().newInstance();
                    if (logger.isInfoEnabled()) {
                        logger.info("using rowMapper " + rowMapper + " for " + modifier);
                    }

                    return rowMapper;
                } catch (Exception ex) {
                    throw new BeanInstantiationException(rowHandler.rowMapper(), ex.getMessage(),
                            ex);
                }
            }
        }
        //

        Class<?> returnClassType = modifier.getMethod().getReturnType();
        Class<?> rowType = getRowType(modifier);

        // BUGFIX: SingleColumnRowMapper 处理  Primitive Type 抛异常
        if (rowType.isPrimitive()) {
            rowType = ClassUtils.primitiveToWrapper(rowType);
        }

        // 根据类型创建  RowMapper
        RowMapper rowMapper;

        // 返回单列的查询的(或者返回只有2列的Map类型查询的)
        if (TypeUtils.isColumnType(rowType)) {
            if (returnClassType == Map.class) {
                rowMapper = new MapEntryColumnRowMapper(modifier, rowType);
            } else {
                rowMapper = new SingleColumnRowMapper(rowType);
            }
        }
        // 返回多列的,用Bean对象、集合、映射、数组来表示每一行的
        else {
            if (rowType == Map.class) {
                rowMapper = new ColumnMapRowMapper();
            } else if (rowType.isArray()) {
                rowMapper = new ArrayRowMapper(rowType);
            } else if ((rowType == List.class) || (rowType == Collection.class)) {
                rowMapper = new ListRowMapper(modifier);
            } else if (rowType == Set.class) {
                rowMapper = new SetRowMapper(modifier);
            } else {
                boolean checkColumns = (rowHandler == null) ? true : rowHandler.checkColumns();
                boolean checkProperties = (rowHandler == null) ? false : rowHandler
                        .checkProperties();
                String key = rowType.getName() + "[checkColumns=" + checkColumns
                        + "&checkProperties=" + checkProperties + "]";
                rowMapper = rowMappers.get(key);
                if (rowMapper == null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.