@Override public void saveBooking(Booking booking) throws DAOException { Connection connect = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { connect = ConnectionPool.getPool().getConnection(); preparedStatement = connect.prepareStatement(SAVE_BOOKING); // preparedStatement.setInt(1, booking.getId()); preparedStatement.setInt(1, booking.getRoomId()); preparedStatement.setInt(2, booking.getAccountId()); Date orderDate = new Date(booking.getCheckinDate().getTime()); preparedStatement.setDate(3, orderDate); Date checkinDate = new Date(booking.getCheckinDate().getTime()); preparedStatement.setDate(4, checkinDate); Date checkoutDate = new Date(booking.getCheckoutDate().getTime()); preparedStatement.setDate(5, checkoutDate); preparedStatement.executeUpdate(); } catch (Exception e) { throw new DAOException(e); } finally { ConnectionPool.releaseConnection(connect, preparedStatement, resultSet); } }