Package com.ibatis.sqlmap.client

Examples of com.ibatis.sqlmap.client.SqlMapClient


  private XmlSqlMapBuilder() {
  }

  public static SqlMap buildSqlMap(Reader reader) {
    SqlMapConfigParser parser = new SqlMapConfigParser(SQL_MAP_CONVERTER, SQL_MAP_CONVERTER);
    SqlMapClient client = parser.parse(reader);
    return new SqlMap(client);
  }
View Full Code Here


    return new SqlMap(client);
  }

  public static SqlMap buildSqlMap(Reader reader, Properties props) {
    SqlMapConfigParser parser = new SqlMapConfigParser(SQL_MAP_CONVERTER, SQL_MAP_CONVERTER);
    SqlMapClient client = parser.parse(reader, props);
    return new SqlMap(client);
  }
View Full Code Here

            }
        }
    }

    public List poll(IBatisConsumer consumer, IBatisEndpoint endpoint) throws Exception {
        SqlMapClient client = endpoint.getSqlMapClient();
        return client.queryForList(endpoint.getStatement(), null);
    }
View Full Code Here

public class DefaultIBatisProcessingStategy implements IBatisProcessingStrategy {

    private int isolation = Connection.TRANSACTION_REPEATABLE_READ;

    public void commit(IBatisEndpoint endpoint, Exchange exchange, Object data, String consumeStatements) throws Exception {
        SqlMapClient client = endpoint.getSqlMapClient();
        boolean useTrans = endpoint.isUseTransactions();
        String[] statements = consumeStatements.split(",");
        try {
            if (useTrans) {
                client.startTransaction(isolation);
            }
            for (String statement : statements) {
                client.update(statement.trim(), data);
            }
            if (useTrans) {
                client.commitTransaction();
            }
        } finally {
            if (useTrans) {
                client.endTransaction();
            }
        }
    }
View Full Code Here

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

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

        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

        doProcessResult(exchange, result);
    }

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

        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

        doProcessResult(exchange, result);
    }

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

        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

            doProcessResult(exchange, result);
        }
    }

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

        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

            doProcessResult(exchange, result);
        }
    }

    private void doDelete(Exchange exchange) throws Exception {
        SqlMapClient client = endpoint.getSqlMapClient();

        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("Deleting: " + value + " using statement: " + statement);
                }
                result = client.delete(statement, value);
                doProcessResult(exchange, result);
            }
        } else {
            if (LOG.isTraceEnabled()) {
                LOG.trace("Deleting using statement: " + statement);
            }
            result = client.delete(statement);
            doProcessResult(exchange, result);
        }
    }
View Full Code Here

            doProcessResult(exchange, result);
        }
    }

    private void doDelete(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("Deleting: " + value + " using statement: " + statement);
                }
                result = client.delete(statement, value);
                doProcessResult(exchange, result);
            }
        } else {
            if (LOG.isTraceEnabled()) {
                LOG.trace("Deleting using statement: " + statement);
            }
            result = client.delete(statement);
            doProcessResult(exchange, result);
        }
    }
View Full Code Here

TOP

Related Classes of com.ibatis.sqlmap.client.SqlMapClient

Copyright © 2018 www.massapicom. 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.