public void updateHouse(L1House house) { Connection con = null; PreparedStatement pstm = null; try { con = L1DatabaseFactory.getInstance().getConnection(); pstm = con.prepareStatement( "UPDATE house SET house_name=?, house_area=?, location=?, keeper_id=?, is_on_sale=?, is_purchase_basement=?, tax_deadline=? WHERE house_id=?"); pstm.setString(1, house.getHouseName()); pstm.setInt(2, house.getHouseArea()); pstm.setString(3, house.getLocation()); pstm.setInt(4, house.getKeeperId()); pstm.setInt(5, house.isOnSale() == true ? 1 : 0); pstm.setInt(6, house.isPurchaseBasement() == true ? 1 : 0); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String fm = formatter.format(house.getTaxDeadline().getTime()); pstm.setString(7, fm); pstm.setInt(8, house.getHouseId()); pstm.execute(); } catch (SQLException e) { _log.log(Level.SEVERE, e.getLocalizedMessage(), e); } finally { SQLUtil.close(pstm); SQLUtil.close(con); } }