bonjour à tous je débute avec java et j'aimerai développer une application des gestion des étudiants avec leurs notes ,pour ça j'ai créer les classes et les fichiers de mapping ,A l’exécution on m'affiche [BUILD SUCCESSFUL (total time: 2 seconds)]mais rien n'est inséré dans ma base mysql
voici le code de la classe étudiant
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
122
123
124
125
126
127
128
129
 
 
package bean;
 
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
 
public class Etudiant {
 
    private String numinscription;
    private String nom;
    private String prenom;
    private Date dateNaissance;
    private String lieuNaissance;
    private String Sexe;
    private String Nationalité;
    private int année;
    private boolean repetitif;
    private Set<Note> noteGlobale = new HashSet<Note>();
 
    public Etudiant(){}
 
    public Etudiant(String nom, String prenom) {
        this.nom = nom;
        this.prenom = prenom;
    }
 
 
    public Etudiant(String numinscription, String nom, String prenom, Date dateNaissance, String lieuNaissance, String Sexe, String Nationalité, int année, boolean repetitif) {
        this.numinscription = numinscription;
        this.nom = nom;
        this.prenom = prenom;
        this.dateNaissance = dateNaissance;
        this.lieuNaissance = lieuNaissance;
        this.Sexe = Sexe;
        this.Nationalité = Nationalité;
        this.année = année;
        this.repetitif = repetitif;
    }
 
    public boolean isRepetitif() {
        return repetitif;
    }
 
    public void setRepetitif(boolean repetitif) {
        this.repetitif = repetitif;
    }
 
 
    public String getNuminscription() {
        return numinscription;
    }
 
    public String getNom() {
        return nom;
    }
 
    public String getPrenom() {
        return prenom;
    }
 
    public Date getDateNaissance() {
        return dateNaissance;
    }
 
    public String getLieuNaissance() {
        return lieuNaissance;
    }
 
    public String getSexe() {
        return Sexe;
    }
 
    public String getNationalité() {
        return Nationalité;
    }
 
    public int getAnnée() {
        return année;
    }
 
    public Set<Note> getNoteGlobale() {
        return noteGlobale;
    }
 
    public void setNuminscription(String numinscription) {
        this.numinscription = numinscription;
    }
 
    public void setNom(String nom) {
        this.nom = nom;
    }
 
    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }
 
    public void setDateNaissance(Date dateNaissance) {
        this.dateNaissance = dateNaissance;
    }
 
    public void setLieuNaissance(String lieuNaissance) {
        this.lieuNaissance = lieuNaissance;
    }
 
    public void setSexe(String Sexe) {
        this.Sexe = Sexe;
    }
 
    public void setNationalité(String Nationalité) {
        this.Nationalité = Nationalité;
    }
 
    public void setAnnée(int année) {
        this.année = année;
    }
 
    public void setNoteGlobale(Set<Note> noteGlobale) {
        this.noteGlobale = noteGlobale;
    }
 
    public void setDateNaissance(String string) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
 
 
 
}

et le code de la classe note
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
 
package bean;
public class Note {
    private int numNote;
    private float note;
 
    public Note() {
    }
public Note(int numNote, float note) {
        this.numNote = numNote;
        this.note = note;
    }
 
    public int getNumNote() {
        return numNote;
    }
 
    public float getNote() {
        return note;
    }
 
    public void setNumNote(int numNote) {
        this.numNote = numNote;
    }
 
    public void setNote(float note) {
        this.note = note;
    }
 
 
}
les fichiers de mapping
etudiant.hbm.xml
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
 
<?xml version="1.0" encoding="UTF-8"?>
<hibernate-mapping>
    <class name = "bean.Etudiant" table = "etudiants">
        <id name = "numinscription" column = "num_inscription">      
        </id>
        <property name = "nom" column = "Nom">      
        </property>
        <property name = "prenom" column = "Prenom">      
        </property>
        <property name = "dateNaissance" column = "date_naissance">      
        </property>
        <set name="noteglobale" cascade = "all">
            <key column="numNote"/>
            <one-to-many class = "bean.Note"/>
        </set>
 
    </class>
</hibernate-mapping>
et note.hbm.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
<?xml version="1.0" encoding="UTF-8"?>
<hibernate-mapping>
    <class name = "bean.Note" table = "notes">
        <property name = "valNote" column = "valeure">      
        </property>
        <property name = "semestre" column = "num_semestre">      
        </property>
        <property name = "designmodule" column = "design_module">      
        </property>
        <property name = "année" column = "année_étude">      
        </property>
    </class>
</hibernate-mapping>
Merci d'avance pour l'intérêt que vous porterez.