/**
   * Récupère une liste d'étudiant depuis la base de donéne
   *
   * @return la liste de type GestionEtudiants
   * @author Delaby Pierre
   */
  public GestionEtudiants getValsFromBdd() {

    GestionEtudiants liste = new GestionEtudiants();

    // Récupération des étudiants
    try {
      /*
       * 0 choix pas fais
       * 1 etud
       * 2 marche travail
       * 3 sais pas
       *
       * SELECT choix.id_etud, nom_etud, prenom_etud, choix_etud, intitule_form, lieu, priorite
       * FROM 	pierdela_java.etudiants, pierdela_java.choix, pierdela_java.formations
       * WHERE 	choix.id_etud = etudiants.id_etud
       * AND		formations.id_form = choix.id_form
       * UNION
       * SELECT id_etud, nom_etud, prenom_etud, choix_etud, 0, 0, 0
       * FROM 	perdela_java.etudians
       * WHERE	choix_etud =  0
       * ORDER BY id_etud, priorite
       */
      Statement requete = this.connect.createStatement();
      ResultSet res =
          requete.executeQuery(
              "SELECT choix.id_etud, nom_etud, prenom_etud, choix_etud, intitule_form, lieu, priorite  FROM 	jeanpier_pv.etudiants, jeanpier_pv.choix, jeanpier_pv.formations  WHERE 	choix.id_etud = etudiants.id_etud  AND		formations.id_form = choix.id_form  UNION SELECT id_etud, nom_etud, prenom_etud, choix_etud, 0, 0, 0 FROM 	jeanpier_pv.etudiants WHERE	choix_etud != 1 ORDER BY id_etud, priorite");

      while (res.next()) {
        // Opération sur chaque étudiant
        Etudiant etud =
            new Etudiant(
                res.getInt("id_etud"), res.getString("nom_etud"), res.getString("prenom_etud"));

        // Choix d'orientation
        Orientation orient;
        switch (res.getInt("choix_etud")) {
          case 1:
            orient = Orientation.poursuite_etude;
            break;
          case 2:
            orient = Orientation.marche_travail;
            break;
          case 3:
            orient = Orientation.sais_pas;
            break;
          default:
            orient = Orientation.pas_choisi;
            break;
        }
        etud.setChoixEtud(orient);

        // Si l'étudiant n'existe pas, je le crée
        if (!liste.contains(etud)) liste.add(etud);

        // Si l'étudiant à choisi une formation, je l'ajoute
        if (orient == Orientation.poursuite_etude || orient == Orientation.marche_travail) {
          Formation f = new Formation(res.getString("intitule_form"), res.getString("lieu"));
          liste.get(liste.indexOf(etud)).addFormation(f);
        }
      }
    } catch (SQLException sqle) {
      System.out.println("Erreur à la connexion : " + sqle.getMessage());
    }

    // Fermeture
    try {
      if (this.connect != null) this.connect.close();
    } catch (SQLException e) {
      e.printStackTrace();
    }

    return liste;
  }