Package org.springframework.jdbc.core

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


        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

    JdbcTemplate template = EasyMock.createMock(JdbcTemplate.class);
    provider.setJdbcTemplate(template);
    provider.setDialect(new DerbyDialect());

    // Expectations
    EasyMock.expect(template.query(EasyMock.anyObject(PreparedStatementCreator.class), EasyMock.anyObject(RowMapper.class)))
        .andReturn(countRes);
    EasyMock.expect(
        template.query(EasyMock.capture(creator),
            EasyMock.capture(mapper))).andReturn(
        objects);
View Full Code Here

    // Expectations
    EasyMock.expect(template.query(EasyMock.anyObject(PreparedStatementCreator.class), EasyMock.anyObject(RowMapper.class)))
        .andReturn(countRes);
    EasyMock.expect(
        template.query(EasyMock.capture(creator),
            EasyMock.capture(mapper))).andReturn(
        objects);
    // Test
    EasyMock.replay(template);
    JsonObject result = provider.getEvents(0, "base", new CriteriaAdapter(0, 100,
View Full Code Here

            DataSource ds = (DataSource) getApplicationContext().getBean(dsName);
            JdbcTemplate template = new JdbcTemplate(ds);

            // 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
            results = template.query(spelSqlQuery, new ColumnMapRowMapper());
            log.debug("found {} results for query {}", results.size(), spelSqlQuery);

            if (cache != null) {
                log.debug("Adding SQL results to cache {}, query: {}, substituted query: {}", cache.getName(),
                        sqlQuery, spelSqlQuery);
View Full Code Here

      selectStatementToUse = strat.createSelectStatement();

      Dao.selectStatements.put(type, selectStatementToUse);
    }

    List<T> results = select.query(selectStatementToUse,
        new Object[] { id }, new TemplateRowMapper<T>(type));

    if (results.size() > 0) {
      return results.get(0);
    }
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.