SHARE
TWEET

get

a guest Oct 21st, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public Coffee get(String name) {
  2.         String sql = "SELECT COF_NAME SUP_ID, PRICE, SALES, TOTAL FROM COFFEES "
  3.                   + "WHERE COF_NAME = :cof_name";
  4.         MapSqlParameterSource params = new MapSqlParameterSource("cof_name", name);
  5.         return jdbc.query(sql, params, new ResultSetExtractor<Coffee>() {
  6.  
  7.             @Override
  8.             public Coffee extractData(ResultSet rs) throws SQLException, DataAccessException {
  9.                
  10.                                 while(rs.next()){
  11.                                 String nazwa=rs.getString("COF_NAME");
  12.                                 int supplierID = rs.getInt("sup_id");
  13.                                 BigDecimal price = rs.getBigDecimal("PRICE");
  14.                                 int sales = rs.getInt("SALES");
  15.                                 int total = rs.getInt("TOTAL");
  16.                                 Coffee temp= new Coffee("",supplierID,price,sales,total);
  17.                                 System.out.println("COF_NAME"+""+"SUP_ID"+supplierID+"PRICE"+price+"SALES"+sales+"TOTAL"+total);
  18.                                 return temp;
  19.                                 }
  20.                 //throw new UnsupportedOperationException("Not implemented yet.");}
  21.                                 return null;
  22.             }
  23.         });
  24.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top