Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.JdbcTemplate.query()


    }

    private Object[] getParameters(final String tableName, final Attributes attrs) {
        JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);

        Map<String, Integer> colTypes = jdbcTemplate.query("SELECT * FROM " + tableName,
                new ResultSetExtractor<Map<String, Integer>>() {

            @Override
            public Map<String, Integer> extractData(final ResultSet rs) throws SQLException, DataAccessException {
                Map<String, Integer> colTypes = new HashMap<String, Integer>();
View Full Code Here


    JdbcTemplate jdbc = ctx.getBean("template", JdbcTemplate.class);
    String tableName = "testHiveDriverTable";

    jdbc.execute("drop table if exists " + tableName);
    jdbc.execute("create table " + tableName + " (key int, value string)");
    jdbc.query("show tables", new ResultSetExtractor<String>() {
      public String extractData(ResultSet rs) throws SQLException, DataAccessException {
        return "";
      }
    });
View Full Code Here

      public String extractData(ResultSet rs) throws SQLException, DataAccessException {
        return "";
      }
    });

    jdbc.query("select count(1) from " + tableName, new ResultSetExtractor<String>() {
      public String extractData(ResultSet rs) throws SQLException, DataAccessException {
        return "";
      }
    });
  }
View Full Code Here

   
    // Execute the SQL query and build a results object.  This result
    // will consist of one rowname -> rowvalue map for each row in the
    // result set
    Collection<Map<?,?>> results =
      (Collection<Map<?,?>>) template.query(sqlQuery, new ColumnMapRowMapper());
   
    // build the model
    Map<Object,Object> model = new HashMap<Object,Object>();
    model.put("results", results);
   
View Full Code Here

        String qq_SQL = "select *  from Customer " +
                        "where CustomerName = ? ";
        Object[] qq_SQLParams = new Object[] {pName };
        // TODO [112,Info]: Using the * in a query rather than explicitly enumerating the column list is often inefficient.
        JdbcTemplate qq_Template = dBConnection.getTemplate();
        List qq_List = qq_Template.query(qq_SQL, qq_SQLParams, new BeanRowMapper(aCustomer, Customer.class));
        if (!qq_List.isEmpty()) {
            aCustomer = (Customer)DataAccessUtils.singleResult(qq_List);
        }
        qq_RowCount = qq_List.size();
        recsReturned = qq_RowCount;
View Full Code Here

            pSelHoldCustName,
            pSelHoldStockName
        };
        // TODO [112,Info]: Using the * in a query rather than explicitly enumerating the column list is often inefficient.
        JdbcTemplate qq_Template = dBConnection.getTemplate();
        List qq_List = qq_Template.query(qq_SQL, qq_SQLParams, new BeanRowMapper(aHolding, Holding.class));
        if (!qq_List.isEmpty()) {
            aHolding = (Holding)DataAccessUtils.singleResult(qq_List);
        }
        qq_RowCount = qq_List.size();
        recsReturned = qq_RowCount;
View Full Code Here

                        "from Holding " +
                        "where CustomerName = ? ";
        Object[] qq_SQLParams = new Object[] {pName };
        // TODO [112,Info]: Using the * in a query rather than explicitly enumerating the column list is often inefficient.
        JdbcTemplate qq_Template = dBConnection.getTemplate();
        aCustomersHoldingList = (Array_Of_Holding)qq_Template.query(qq_SQL, qq_SQLParams, new ArrayRowMapper(aCustomersHoldingList, Array_Of_Holding.class));

        return aCustomersHoldingList;
    }

    /**
 
View Full Code Here

        String qq_SQL = "select *  from Customer " +
                        "where CustomerName = ? ";
        Object[] qq_SQLParams = new Object[] {pName };
        // TODO [112,Info]: Using the * in a query rather than explicitly enumerating the column list is often inefficient.
        JdbcTemplate qq_Template = dBConnection.getTemplate();
        List qq_List = qq_Template.query(qq_SQL, qq_SQLParams, new BeanRowMapper(aCustomer, Customer.class));
        if (!qq_List.isEmpty()) {
            aCustomer = (Customer)DataAccessUtils.singleResult(qq_List);
        }
        qq_RowCount = qq_List.size();
        recsReturned = qq_RowCount;
View Full Code Here

            pSelHoldCustName,
            pSelHoldStockName
        };
        // TODO [112,Info]: Using the * in a query rather than explicitly enumerating the column list is often inefficient.
        JdbcTemplate qq_Template = dBConnection.getTemplate();
        List qq_List = qq_Template.query(qq_SQL, qq_SQLParams, new BeanRowMapper(aHolding, Holding.class));
        if (!qq_List.isEmpty()) {
            aHolding = (Holding)DataAccessUtils.singleResult(qq_List);
        }
        qq_RowCount = qq_List.size();
        recsReturned = qq_RowCount;
View Full Code Here

                        "from Holding " +
                        "where CustomerName = ? ";
        Object[] qq_SQLParams = new Object[] {pName };
        // TODO [112,Info]: Using the * in a query rather than explicitly enumerating the column list is often inefficient.
        JdbcTemplate qq_Template = dBConnection.getTemplate();
        aCustomersHoldingList = (Array_Of_Holding)qq_Template.query(qq_SQL, qq_SQLParams, new ArrayRowMapper(aCustomersHoldingList, Array_Of_Holding.class));

        return aCustomersHoldingList;
    }

    /**
 
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.