Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.PreparedStatementCallback


        this.jdbcTemplate = jdbcTemplate;
        this.query = query;
    }

    public void process(final Exchange exchange) throws Exception {
        jdbcTemplate.execute(query, new PreparedStatementCallback() {
            public Object doInPreparedStatement(PreparedStatement ps) throws SQLException,
                DataAccessException {
                int argNumber = 1;
                try {
                    Iterator<?> iterator = exchange.getIn().getBody(Iterator.class);
View Full Code Here


        public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
          return connection.prepareStatement("select t.*, td.* from Tests t inner join TestDetails td on t.TestId = td.Test");
        }
      
      },
      new PreparedStatementCallback() {

        private int testId = -1;
       
        public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
          List result = new ArrayList();
View Full Code Here

        this.query = query;
    }

    @SuppressWarnings("unchecked")
    public void process(final Exchange exchange) throws Exception {
        jdbcTemplate.execute(query, new PreparedStatementCallback() {
            public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
                int argNumber = 1;

                // number of parameters must match
                int expected = ps.getParameterMetaData().getParameterCount();
View Full Code Here

    NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(mockDataSource);
    Map params = new HashMap();
    params.put("perfId", new Integer(1));
    params.put("priceId", new Integer(1));
    assertEquals("result", jt.execute(UPDATE_NAMED_PARAMETERS, params, new PreparedStatementCallback() {
      public Object doInPreparedStatement(PreparedStatement ps) throws SQLException {
        assertEquals(mockPreparedStatement, ps);
        ps.executeUpdate();
        return "result";
      }
View Full Code Here

    NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(mockDataSource);
    Map params = new HashMap();
    params.put("perfId", new SqlParameterValue(Types.DECIMAL, new Integer(1)));
    params.put("priceId", new SqlParameterValue(Types.INTEGER, new Integer(1)));
    assertEquals("result", jt.execute(UPDATE_NAMED_PARAMETERS, params, new PreparedStatementCallback() {
      public Object doInPreparedStatement(PreparedStatement ps) throws SQLException {
        assertEquals(mockPreparedStatement, ps);
        ps.executeUpdate();
        return "result";
      }
View Full Code Here

        this.jdbcTemplate = jdbcTemplate;
        this.query = query;
    }

    public void process(final Exchange exchange) throws Exception {
        jdbcTemplate.execute(query, new PreparedStatementCallback() {
            public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
                int argNumber = 1;

                // number of parameters must match
                int expected = ps.getParameterMetaData().getParameterCount();
View Full Code Here

        this.jdbcTemplate = jdbcTemplate;
        this.query = query;
    }

    public void process(final Exchange exchange) throws Exception {
        jdbcTemplate.execute(query, new PreparedStatementCallback() {
            public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
                int argNumber = 1;

                if (exchange.getIn().getBody() != null) {
                    Iterator<?> iterator = exchange.getIn().getBody(Iterator.class);
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public void process(final Exchange exchange) throws Exception {
        String queryHeader = exchange.getIn().getHeader(SqlConstants.SQL_QUERY, String.class);
        jdbcTemplate.execute(queryHeader != null ? queryHeader : query, new PreparedStatementCallback() {
            public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
                int argNumber = 1;

                // number of parameters must match
                int expected = ps.getParameterMetaData().getParameterCount();
View Full Code Here

        this.jdbcTemplate = jdbcTemplate;
        this.query = query;
    }

    public void process(final Exchange exchange) throws Exception {
        jdbcTemplate.execute(query, new PreparedStatementCallback() {
            public Object doInPreparedStatement(PreparedStatement ps) throws SQLException,
                DataAccessException {
                int argNumber = 1;
                try {
                    Iterator<?> iterator = exchange.getIn().getBody(Iterator.class);
View Full Code Here

    }

    public void process(final Exchange exchange) throws Exception {


        jdbcTemplate.execute(query, new PreparedStatementCallback() {

            public Object doInPreparedStatement(PreparedStatement ps) throws SQLException,
                DataAccessException {
                int argNumber = 1;
                for (Iterator<?> i = exchange.getIn().getBody(Iterator.class); i.hasNext();) {
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.PreparedStatementCallback

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.