Bonjour à tous,
J'ai un problème avec un comboBox en JavaFX. Je souhaite remplir un comboBox grâce à une colonne de ma base de données.

Voici mon code pour ajouter les données de ma BDD dans ma comboBox :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
public class EnregistrerTigController implements Initializable {
 
 
@FXML
    ComboBox<DaoIdRole> comboBoxSection;
 
    @FXML
    ComboBox<DaoIdMateriel> comboBoxMateriel;
 
    @FXML
    private TextField nomTig;
 
    @FXML
    private Button backButton;
 
    @Override
    public void initialize(URL url, ResourceBundle resourceBundle) {
 
        ObservableList<DaoIdRole> listSection = FXCollections.observableArrayList();
        ObservableList<DaoIdMateriel> listMateriel = FXCollections.observableArrayList();
 
        try {
            Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/le_pigeonnier", "root", "root");
            ResultSet resultSection = connection.createStatement().executeQuery("SELECT idSection FROM section");
            ResultSet resultMateriel = connection.createStatement().executeQuery("SELECT idMateriel FROM materiel");
 
            while(resultSection.next()){
                listSection.add(new DaoIdRole(resultSection.getString("idSection")));
            }
            while(resultMateriel.next()){
                listMateriel.add(new DaoIdMateriel(resultMateriel.getString("idMateriel")));
            }
            comboBoxSection.setItems(listSection);
            comboBoxMateriel.setItems(listMateriel);
 
        } catch (SQLException e) {
            e.printStackTrace();
        }
 
    }
}
Mon DAO (idFonction) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package eu.hautil.pigeonnier.tig;
 
public class DaoIdRole {
    String idFonction;
 
    public DaoIdRole(String idFonction) {
        this.idFonction = idFonction;
    }
 
    public String getIdFonction() {
        return idFonction;
    }
 
    public void setIdFonction(String idFonction) {
        this.idFonction = idFonction;
    }
}
Mon DAO (idMateriel) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package eu.hautil.pigeonnier.tig;
 
public class DaoIdMateriel {
    String idMateriel;
 
    public DaoIdMateriel(String idMateriel) {
        this.idMateriel = idMateriel;
    }
 
    public String getIdMateriel() {
        return idMateriel;
    }
 
    public void setIdMateriel(String idMateriel) {
        this.idMateriel = idMateriel;
    }
}

Et voici ce que ça m'affiche dans ma comboBox :

Nom : Screenshot_1.png
Affichages : 214
Taille : 172,9 Ko

Je ne comprends pas pourquoi ça s'affiche comme ça, j'ai cherché sur plusieurs forums et je n'ai pas trouvé de problèmes similaire au mien. Je n'ai bien sûr aucune erreur lors de l'exécution de mon code.

Merci d'avance pour votre aide !