Bonjour,

je fait un appel d'une procédure strockée qui me renvoi les commandes sur base de l'id d'un client.
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
public ArrayList<Commande> find(int id) {
        listCommandes = new ArrayList<>();
        try (Connection con = ConnectDB.getInstance().getConnection()) {
            String query = "{call select_commande_byClient_id(?)}";
            try (PreparedStatement preparedStmt = con.prepareStatement(query)) {
                preparedStmt.setInt(5, id);
                ResultSet res = preparedStmt.executeQuery();
                while (res.next()) {
                    Commande cmd = new Commande();
                    Client client = new Client();
                    cmd.setId(res.getInt("PK_id_commandes"));
                    cmd.setDateCommande(res.getString("date_commandes"));
                    cmd.setMontantCommandes(res.getDouble("montant_commandes"));
                    cmd.setCommandeCloturee(res.getBoolean("cloture_commandes"));
                    cmd.setClient(res.getObject("PK_id_clients", Client));
                    listCommandes.add(cmd);
                }
        }
        } catch (SQLException ex) {
            Logger.getLogger(ArticleCommandeDAO.class.getName()).log(Level.SEVERE, null, ex);
            System.out.println("error: " + ex);
        }
        return listCommandes;
    }
ma procédure inclus un client avec son ID , nom et prénom. Donc un objet Client dans mon Objet Commande.
Nom : Capture.PNG
Affichages : 76
Taille : 10,3 Ko

Comment accéder et faire un

Code : Sélectionner tout - Visualiser dans une fenêtre à part
cmd.setClient(res.getObject("PK_id_clients", Client));
Pour l'id client, son nom et son prenom?