public int updateStock(Item item, int quantity) throws ConnectException,
			SQLException {
		Connection con = ConnectionService.getConnection();
		String query = "update item set item_stock=? where upc=?";
		PreparedStatement query_ps = con.prepareStatement(query);
		int j = 0;
		if (item.getQuantity() < quantity) {
			j = 0;
			item.setErrorMessage("Requested Quantity Not Available. Quantity set to Available stock");
			item.setQuantity(item.getQuantity());
		} else {
			j = item.getQuantity() - quantity;
			System.out.println(j);
			item.setQuantity(quantity);
		}
		query_ps.setInt(1, j);
		query_ps.setString(2, item.getUPC());

		int i = query_ps.executeUpdate();
		System.out.println(i);
		con.commit();
		return i;
	}