@Override public void addStockRecord(StockRecord stockRecord) throws OmsDataAccessException { try { jdbcTemplate.update( addStockRecordQuery, new Object[] { stockRecord.getTransDocRef(), stockRecord.getProduct().getProductId(), stockRecord.getFromTo(), stockRecord.getGoodIn(), stockRecord.getGoodOut(), stockRecord.getGoodBalance(), stockRecord.getDefIn(), stockRecord.getDefOut(), stockRecord.getDefBalance() }); } catch (DataAccessException dae) { throw new OmsDataAccessException(dae); } }
public StockRecord mapRow(ResultSet resultSet, int arg1) throws SQLException { StockRecord stockRecord = new StockRecord(); stockRecord.setRecordId(resultSet.getLong("record_id")); stockRecord.setTransDocRef(resultSet.getString("trans_doc_ref")); stockRecord.setFromTo(resultSet.getString("fromTo")); stockRecord.setGoodIn(resultSet.getLong("good_in")); stockRecord.setGoodOut(resultSet.getLong("good_out")); stockRecord.setGoodBalance(resultSet.getLong("good_balance")); stockRecord.setDefIn(resultSet.getLong("def_in")); stockRecord.setDefOut(resultSet.getLong("def_out")); stockRecord.setDefBalance(resultSet.getLong("def_balance")); stockRecord.setCreatedDate(resultSet.getString("created_date")); Product product = new Product(); product.setProductId(resultSet.getLong("product_id")); product.setProductName(resultSet.getString("product_name")); stockRecord.setProduct(product); return stockRecord; }