Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Coffee get(String name) {
- String sql = "SELECT COF_NAME SUP_ID, PRICE, SALES, TOTAL FROM COFFEES "
- + "WHERE COF_NAME = :cof_name";
- MapSqlParameterSource params = new MapSqlParameterSource("cof_name", name);
- return jdbc.query(sql, params, new ResultSetExtractor<Coffee>() {
- @Override
- public Coffee extractData(ResultSet rs) throws SQLException, DataAccessException {
- while(rs.next()){
- String nazwa=rs.getString("COF_NAME");
- int supplierID = rs.getInt("sup_id");
- BigDecimal price = rs.getBigDecimal("PRICE");
- int sales = rs.getInt("SALES");
- int total = rs.getInt("TOTAL");
- Coffee temp= new Coffee("",supplierID,price,sales,total);
- System.out.println("COF_NAME"+""+"SUP_ID"+supplierID+"PRICE"+price+"SALES"+sales+"TOTAL"+total);
- return temp;
- }
- //throw new UnsupportedOperationException("Not implemented yet.");}
- return null;
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement