Examples of SqlMapClient


Examples of com.ibatis.sqlmap.client.SqlMapClient

            throw new IllegalArgumentException("Unsupported statementType: " + endpoint.getStatementType());
        }
    }

    private void doQueryForObject(Exchange exchange) throws Exception {
        SqlMapClient client = endpoint.getSqlClient();

        Object result;
        Object in = exchange.getIn().getBody();
        if (in != null) {
            if (LOG.isTraceEnabled()) {
                LOG.trace("QueryForObject: " + in + "  using statement: " + statement);
            }
            result = client.queryForObject(statement, in);
        } else {
            if (LOG.isTraceEnabled()) {
                LOG.trace("QueryForObject using statement: " + statement);
            }
            result = client.queryForObject(statement);
        }

        doProcessResult(exchange, result);
    }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

        doProcessResult(exchange, result);
    }

    private void doQueryForList(Exchange exchange) throws Exception {
        SqlMapClient client = endpoint.getSqlClient();

        Object result;
        Object in = exchange.getIn().getBody();
        if (in != null) {
            if (LOG.isTraceEnabled()) {
                LOG.trace("QueryForList: " + in + "  using statement: " + statement);
            }
            result = client.queryForList(statement, in);
        } else {
            if (LOG.isTraceEnabled()) {
                LOG.trace("QueryForList using statement: " + statement);
            }
            result = client.queryForList(statement);
        }

        doProcessResult(exchange, result);
    }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

        doProcessResult(exchange, result);
    }

    private void doInsert(Exchange exchange) throws Exception {
        SqlMapClient client = endpoint.getSqlClient();

        Object result;
        Object in = exchange.getIn().getBody();
        if (in != null) {
            // lets handle arrays or collections of objects
            Iterator iter = ObjectHelper.createIterator(in);
            while (iter.hasNext()) {
                Object value = iter.next();
                if (LOG.isTraceEnabled()) {
                    LOG.trace("Inserting: " + value + " using statement: " + statement);
                }
                result = client.insert(statement, value);
                doProcessResult(exchange, result);
            }
        } else {
            if (LOG.isTraceEnabled()) {
                LOG.trace("Inserting using statement: " + statement);
            }
            result = client.insert(statement);
            doProcessResult(exchange, result);
        }
    }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

            doProcessResult(exchange, result);
        }
    }

    private void doUpdate(Exchange exchange) throws Exception {
        SqlMapClient client = endpoint.getSqlClient();

        Object result;
        Object in = exchange.getIn().getBody();
        if (in != null) {
            // lets handle arrays or collections of objects
            Iterator iter = ObjectHelper.createIterator(in);
            while (iter.hasNext()) {
                Object value = iter.next();
                if (LOG.isTraceEnabled()) {
                    LOG.trace("Updating: " + value + " using statement: " + statement);
                }
                result = client.update(statement, value);
                doProcessResult(exchange, result);
            }
        } else {
            if (LOG.isTraceEnabled()) {
                LOG.trace("Updating using statement: " + statement);
            }
            result = client.update(statement);
            doProcessResult(exchange, result);
        }
    }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

    conControl.replay();

    MockControl sessionControl = MockControl.createControl(SqlMapSession.class);
    final SqlMapSession session = (SqlMapSession) sessionControl.getMock();
    MockControl clientControl = MockControl.createControl(SqlMapClient.class);
    SqlMapClient client = (SqlMapClient) clientControl.getMock();
    client.openSession();
    clientControl.setReturnValue(session, 1);
    session.getCurrentConnection();
    sessionControl.setReturnValue(null, 1);
    session.setUserConnection(con);
    sessionControl.setVoidCallable(1);
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

    conControl.replay();

    MockControl sessionControl = MockControl.createControl(SqlMapSession.class);
    final SqlMapSession session = (SqlMapSession) sessionControl.getMock();
    MockControl clientControl = MockControl.createControl(SqlMapClient.class);
    SqlMapClient client = (SqlMapClient) clientControl.getMock();
    client.openSession();
    clientControl.setReturnValue(session, 1);
    session.getCurrentConnection();
    sessionControl.setReturnValue(con, 1);
    sessionControl.replay();
    clientControl.replay();
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

    MockControl dsControl = MockControl.createControl(DataSource.class);
    DataSource ds = (DataSource) dsControl.getMock();
    MockControl conControl = MockControl.createControl(Connection.class);
    Connection con = (Connection) conControl.getMock();
    MockControl clientControl = MockControl.createControl(SqlMapClient.class);
    SqlMapClient client = (SqlMapClient) clientControl.getMock();
    MockControl sessionControl = MockControl.createControl(SqlMapSession.class);
    SqlMapSession session = (SqlMapSession) sessionControl.getMock();

    ds.getConnection();
    dsControl.setReturnValue(con, 1);
    con.close();
    conControl.setVoidCallable(1);
    client.getDataSource();
    clientControl.setReturnValue(ds, 2);
    client.openSession();
    clientControl.setReturnValue(session, 1);
    session.getCurrentConnection();
    sessionControl.setReturnValue(null, 1);
    session.setUserConnection(con);
    sessionControl.setVoidCallable(1);
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

    };
    testDao.setDataSource(ds);
    assertEquals(ds, testDao.getDataSource());

    MockControl clientControl = MockControl.createControl(SqlMapClient.class);
    SqlMapClient client = (SqlMapClient) clientControl.getMock();
    clientControl.replay();

    testDao.setSqlMapClient(client);
    assertEquals(client, testDao.getSqlMapClient());
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

  }

  public String execute() throws Exception {
    //TODO  检测username and password,如果出错的话,返回error,交由struts2.0进行处理;
    // 如果正确的话,就会redirect到 EasyJ的原框架进行处理.
    SqlMapClient client = Utils.getMapClient();
    Object user = client.queryForObject("user.getUserByUserName",userName);
    if(user == null){
      System.out.println(userName+" 不存在");
      return ActionSupport.ERROR;
    }else{
      System.out.println(userName+"正确");
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

    if (ObjectUtils.isEmpty(configLocations)) {
      throw new IllegalArgumentException("At least 1 'configLocation' entry is required");
    }

    SqlMapClient client = null;
    SqlMapConfigParser configParser = new SqlMapConfigParser();
    for (Resource configLocation : configLocations) {
      InputStream is = configLocation.getInputStream();
      try {
        client = configParser.parse(is, properties);
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.