@Override
  public Ride updateRide(Ride ride) throws Exception {
    JdbcTemplate template = new JdbcTemplate(ds);
    Object params[] = {
      ride.getStatus(),
      ride.getOriginLat(),
      ride.getOriginLong(),
      ride.getDestLat(),
      ride.getDestLong(),
      ride.getStartDatetime(),
      ride.getEndDatetime(),
      ride.getFare(),
      ride.getRiderRateQuality(),
      ride.getRiderRateMsg(),
      ride.getDriverRateQuality(),
      ride.getDriverRateMsg(),
      ride.getRidersRiderId(),
      ride.getDriversDriverId(),
      ride.getRideId()
    };

    int rowsUpdated = template.update(updateSQL, params);
    if (rowsUpdated == 0) {
      throw new RuntimeException("Ride with ID not found: " + ride.getRideId());
    }
    return ride;
  }
  @Override
  public Ride addRide(Ride ride) throws Exception {
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("status", ride.getStatus());
    parameters.put("origin_lat", ride.getOriginLat());
    parameters.put("origin_long", ride.getOriginLong());
    parameters.put("dest_lat", ride.getDestLat());
    parameters.put("dest_long", ride.getDestLong());
    parameters.put("start_datetime", ride.getStartDatetime());
    parameters.put("end_datetime", ride.getEndDatetime());
    parameters.put("fare", ride.getFare());
    parameters.put("rider_rate_quality", ride.getRiderRateQuality());
    parameters.put("rider_rate_msg", ride.getRiderRateMsg());
    parameters.put("driver_rate_quality", ride.getDriverRateQuality());
    parameters.put("driver_rate_msg", ride.getDriverRateMsg());
    parameters.put("riders_rider_id", ride.getRidersRiderId());
    parameters.put("drivers_driver_id", ride.getDriversDriverId());

    SimpleJdbcInsert insert =
        new SimpleJdbcInsert(ds).withTableName("rides").usingGeneratedKeyColumns("ride_id");

    Number newId = insert.executeAndReturnKey(parameters);
    ride.setRideId(newId.intValue());
    return ride;
  }