@Override
  public List<VehiculoDTO> listarVehiculos() {
    List<VehiculoDTO> data = new ArrayList<VehiculoDTO>();
    VehiculoDTO v = null;
    Connection cn = null;
    PreparedStatement pstm = null;
    String sql = "";
    ResultSet rs = null;

    try {
      cn = MySqlDBConexion.getConexion();
      sql = "select * from vehiculo";
      pstm = cn.prepareStatement(sql);
      rs = pstm.executeQuery();

      while (rs.next()) {
        v = new VehiculoDTO();
        v.setIdVehiculo(rs.getInt(1));
        v.setPlacaVehiculo(rs.getString(2));
        v.setMarcaVehiculo(rs.getString(3));
        v.setModeloVehiculo(rs.getString(4));
        v.setAnioFabricacionVehiculo(rs.getInt(5));
        v.setColorVehiculo(rs.getString(6));

        data.add(v);
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      try {
        if (rs != null) {
          rs.close();
        }
        if (pstm != null) {
          pstm.close();
        }
        if (cn != null) {
          cn.close();
        }
      } catch (Exception e2) {
        e2.printStackTrace();
      }
    }
    return data;
  }
  @Override
  public VehiculoDTO buscarVehiculo(int idVehiculo) {
    VehiculoDTO v = null;
    Connection cn = null;
    PreparedStatement pstm = null;
    String sql = "";
    ResultSet rs = null;

    try {
      cn = MySqlDBConexion.getConexion();
      sql = "select * from vehiculo where idVehiculo = ?";
      pstm = cn.prepareStatement(sql);
      pstm.setInt(1, idVehiculo);
      rs = pstm.executeQuery();

      if (rs.next()) {
        v = new VehiculoDTO();
        v.setIdVehiculo(rs.getInt(1));
        v.setPlacaVehiculo(rs.getString(2));
        v.setMarcaVehiculo(rs.getString(3));
        v.setModeloVehiculo(rs.getString(4));
        v.setAnioFabricacionVehiculo(rs.getInt(5));
        v.setColorVehiculo(rs.getString(6));
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      try {
        if (rs != null) {
          rs.close();
        }
        if (pstm != null) {
          pstm.close();
        }
        if (cn != null) {
          cn.close();
        }
      } catch (Exception e2) {
        e2.printStackTrace();
      }
    }
    return v;
  }