Bonjour à tous,

Je me pose une question, surement de débutant, sur quelle est la meilleure façon d'envoyer des données à une BDD.

Voilà les données :
Je possède une classe personne de ce type là :
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
 
public class Personne {
 
    // Variable statique qui compte le nb de personnes
    private static int nbPersonne = 0;
 
    // Variables caractérisant la personne
    private String civilite;
    private String nom;
    private String prenom;
    private String adresse;
    private String CP;
    private String ville;
    private String telephone;
    private String email;
 
 
    public Personne() {
        nbPersonne++;
        System.out.println("Constructeur vide");
    }
 
    public Personne(String nom, String prenom) {
        this.nom = nom;
        this.prenom = prenom;
 
        nbPersonne++;
        System.out.println("Constructeur avec 2 paramètres");
    }
 
    public Personne(String civilite, String nom, String prenom, String adresse, 
                    String CP, String ville, String telephone, String email) {
 
        this.civilite = civilite;
        this.nom = nom;
        this.prenom = prenom;
        this.adresse = adresse;
        this.CP = CP;
        this.ville = ville;
        this.telephone = telephone;
        this.email = email;
 
        nbPersonne++;
        System.out.println("Constructeur avec tous les paramètres");
    }
 
     public String getCivilite() {
        return civilite;
    }
 
    public void setCivilite(String civilite) {
        this.civilite = civilite;
    }
 
    public String getNom() {
        return nom;
    }
 
    public void setNom(String nom) {
        this.nom = nom;
    }
 
    public String getPrenom() {
        return prenom;
    }
 
    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }
 
    public String getAdresse() {
        return adresse;
    }
 
    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }
 
    public String getCP() {
        return CP;
    }
 
    public void setCP(String CP) {
        this.CP = CP;
    }
 
    public String getVille() {
        return ville;
    }
 
    public void setVille(String ville) {
        this.ville = ville;
    }
 
    public String getTelephone() {
        return telephone;
    }
 
    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }
 
    public String getEmail() {
        return email;
    }
 
    public void setEmail(String email) {
        this.email = email;
    }
 
    @Override
    public String toString() {
        return "Personne{   " + "civilite=" + civilite + ", nom=" + nom + ", prenom=" + prenom + ", adresse=" + 
                            adresse + ", CP=" + CP + ", ville=" + ville + ", telephone=" 
                            + telephone + ", email=" + email + '}';
    }
 
    public int getNbPersonne(){
        return nbPersonne;
    }
}
Et de l'autre côté une BDD avec une table comportant les mêmes champs que mes variables de classes.

Dois-je faire
MaBDD.Nom = Personne.GetNom()
pour tous les champs ?
Ou y a t'il une autre méthode ?

Merci bien