j'espère recevoir une réponse pour être sur que je suis sur le bon chemin pour pouvoir continuer
Version imprimable
j'espère recevoir une réponse pour être sur que je suis sur le bon chemin pour pouvoir continuer
pour cela ma l'aire bon
seul une chose me fait réagir
qui est sur la méthode getId(); c'est peut être juste mais personnellement je n'est jamais fait comme ça je le mette toujours sur la variable.Code:
1
2 @Id @GeneratedValue(strategy = GenerationType.AUTO)
sinon c'est bien comme cela que je m'y prendrais.
je suppose que la class enseignant manque d'autre attribut .car un enseignant dispose d'une spécialités et a un nombre d'absence et retard et fait des séminaires
c 'est mon point de vue
pouvez me corrigez cette class et si elle manque encore d'attributs vous l'ajouter de même pour la class encadreur
pouvez m'aidez a faire une autre class
oui il manque pas mal de chose a enseignent je n'est fait que donner un exemple.
quel partie vous pose problème dans la création d'une nouvelle class ?
vous avais très bien crée Encadreur
(par convention utiliser toujours des lettre majuscule dans le nom de votre class)
merci pour votre réponse
si possible pouvez me corriger la class enseignant en mettant les attributs ainsi les méthodes qui manque sur le même code
j'ai besoin d'un conseil
pour gérer mon application est ce que je dois travailler avec netbeans ou eclipse
je sais que ce sont des IDE mais la différence que netbeans est complète( c a dire j'ai pas besoins d'ajouter d'autre plugins pour gérer tel framwork comme hibernate ou d'autre)
j'ai presque fini de la création des EJB Entity
pouvez m'aidez quel partie je dois attaque maintenant
j'ai modifie un peu des attributs des enseignant
et voila le code complète j'espère qui est juste
Code:
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 package projetfinal.ejb.entites; import java.io.Serializable; import java.util.Collection; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.ManyToMany; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; /** * * @author lefennec */ @Entity @Table(name = "ENSEIGNANT") @NamedQueries({@NamedQuery(name = "Enseignant.findByMatriculeens", query = "SELECT e FROM Enseignant e WHERE e.matriculeens = :matriculeens"), @NamedQuery(name = "Enseignant.findByNomens", query = "SELECT e FROM Enseignant e WHERE e.nomens = :nomens"), @NamedQuery(name = "Enseignant.findByPrenomens", query = "SELECT e FROM Enseignant e WHERE e.prenomens = :prenomens"), @NamedQuery(name = "Enseignant.findBySexeens", query = "SELECT e FROM Enseignant e WHERE e.sexeens = :sexeens"), @NamedQuery(name = "Enseignant.findByGradeens", query = "SELECT e FROM Enseignant e WHERE e.gradeens = :gradeens"), @NamedQuery(name = "Enseignant.findByFonctionens", query = "SELECT e FROM Enseignant e WHERE e.fonctionens = :fonctionens")}) public class Enseignant implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "MATRICULEENS", nullable = false) private String matriculeens; @Column(name = "NOMENS") private String nomens; @Column(name = "PRENOMENS") private String prenomens; @Column(name = "SEXEENS") private String sexeens; @Column(name = "GRADEENS") private String gradeens; @Column(name = "FONCTIONENS") private String fonctionens; @ManyToMany(mappedBy = "matriculeensCollection") private Collection<Cours> codecoursCollection; public Enseignant() { } public Enseignant(String matriculeens) { this.matriculeens = matriculeens; } public String getMatriculeens() { return matriculeens; } public void setMatriculeens(String matriculeens) { this.matriculeens = matriculeens; } public String getNomens() { return nomens; } public void setNomens(String nomens) { this.nomens = nomens; } public String getPrenomens() { return prenomens; } public void setPrenomens(String prenomens) { this.prenomens = prenomens; } public String getSexeens() { return sexeens; } public void setSexeens(String sexeens) { this.sexeens = sexeens; } public String getGradeens() { return gradeens; } public void setGradeens(String gradeens) { this.gradeens = gradeens; } public String getFonctionens() { return fonctionens; } public void setFonctionens(String fonctionens) { this.fonctionens = fonctionens; } public Collection<Cours> getCodecoursCollection() { return codecoursCollection; } public void setCodecoursCollection(Collection<Cours> codecoursCollection) { this.codecoursCollection = codecoursCollection; } @Override public int hashCode() { int hash = 0; hash += (matriculeens != null ? matriculeens.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { if (!(object instanceof Enseignant)) { return false; } Enseignant other = (Enseignant) object; if ((this.matriculeens == null && other.matriculeens != null) || (this.matriculeens != null && !this.matriculeens.equals(other.matriculeens))) { return false; } return true; } @Override public String toString() { return "projetfinal.ejb.entites.Enseignant[matriculeens=" + matriculeens + "]"; } }
j'ajoute la class Département avec un certain nombre d'attribut
et pour la class présenceCode:
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 package projetfinal.ejb.entites; import java.io.Serializable; import java.util.Collection; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; /** * * @author lefennec */ @Entity @Table(name = "DEPARTEMENT") @NamedQueries({@NamedQuery(name = "Departement.findByCodedpt", query = "SELECT d FROM Departement d WHERE d.codedpt = :codedpt"), @NamedQuery(name = "Departement.findByLibelledpt", query = "SELECT d FROM Departement d WHERE d.libelledpt = :libelledpt"), @NamedQuery(name = "Departement.findByNomchefdpt", query = "SELECT d FROM Departement d WHERE d.nomchefdpt = :nomchefdpt")}) public class Departement implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "CODEDPT", nullable = false) private String codedpt; @Column(name = "LIBELLEDPT") private String libelledpt; @Column(name = "NOMCHEFDPT") private String nomchefdpt; @OneToMany(mappedBy = "codedpt") private Collection<Classe> classeCollection; @OneToMany(mappedBy = "codedpt") private Collection<Et> etCollection; @OneToMany(mappedBy = "codedpt") private Collection<Presence> presenceCollection; public Departement() { } public Departement(String codedpt) { this.codedpt = codedpt; } public String getCodedpt() { return codedpt; } public void setCodedpt(String codedpt) { this.codedpt = codedpt; } public String getLibelledpt() { return libelledpt; } public void setLibelledpt(String libelledpt) { this.libelledpt = libelledpt; } public String getNomchefdpt() { return nomchefdpt; } public void setNomchefdpt(String nomchefdpt) { this.nomchefdpt = nomchefdpt; } public Collection<Classe> getClasseCollection() { return classeCollection; } public void setClasseCollection(Collection<Classe> classeCollection) { this.classeCollection = classeCollection; } public Collection<Et> getEtCollection() { return etCollection; } public void setEtCollection(Collection<Et> etCollection) { this.etCollection = etCollection; } public Collection<Presence> getPresenceCollection() { return presenceCollection; } public void setPresenceCollection(Collection<Presence> presenceCollection) { this.presenceCollection = presenceCollection; } @Override public int hashCode() { int hash = 0; hash += (codedpt != null ? codedpt.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Departement)) { return false; } Departement other = (Departement) object; if ((this.codedpt == null && other.codedpt != null) || (this.codedpt != null && !this.codedpt.equals(other.codedpt))) { return false; } return true; } @Override public String toString() { return "projetfinale.ejb.entites.Departement[codedpt=" + codedpt + "]"; } }
la class ClasseCode:
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
130
131
132
133
134
135
136
137
138
139
140
141 package projetfinale.ejb.entites; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; /** * * @author lefennec */ @Entity @Table(name = "PRESENCE") @NamedQueries({@NamedQuery(name = "Presence.findByCodepresence", query = "SELECT p FROM Presence p WHERE p.codepresence = :codepresence"), @NamedQuery(name = "Presence.findByMatriculeens", query = "SELECT p FROM Presence p WHERE p.matriculeens = :matriculeens"), @NamedQuery(name = "Presence.findByPresence", query = "SELECT p FROM Presence p WHERE p.presence = :presence")}) public class Presence implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "CODEPRESENCE", nullable = false) private String codepresence; @Column(name = "MATRICULEENS") private String matriculeens; @Column(name = "PRESENCE") private String presence; @JoinColumn(name = "CODECLASSE", referencedColumnName = "CODECLASSE") @ManyToOne private Classe codeclasse; @JoinColumn(name = "CODECOURS", referencedColumnName = "CODECOURS") @ManyToOne private Cours codecours; @JoinColumn(name = "CODEDPT", referencedColumnName = "CODEDPT") @ManyToOne private Departement codedpt; @JoinColumn(name = "DATEJC", referencedColumnName = "DATEJC") @ManyToOne private Jourcours datejc; @JoinColumn(name = "CODESEANCE", referencedColumnName = "CODESEANCE") @ManyToOne private Seance codeseance; public Presence() { } public Presence(String codepresence) { this.codepresence = codepresence; } public String getCodepresence() { return codepresence; } public void setCodepresence(String codepresence) { this.codepresence = codepresence; } public String getMatriculeens() { return matriculeens; } public void setMatriculeens(String matriculeens) { this.matriculeens = matriculeens; } public String getPresence() { return presence; } public void setPresence(String presence) { this.presence = presence; } public Classe getCodeclasse() { return codeclasse; } public void setCodeclasse(Classe codeclasse) { this.codeclasse = codeclasse; } public Cours getCodecours() { return codecours; } public void setCodecours(Cours codecours) { this.codecours = codecours; } public Departement getCodedpt() { return codedpt; } public void setCodedpt(Departement codedpt) { this.codedpt = codedpt; } public Jourcours getDatejc() { return datejc; } public void setDatejc(Jourcours datejc) { this.datejc = datejc; } public Seance getCodeseance() { return codeseance; } public void setCodeseance(Seance codeseance) { this.codeseance = codeseance; } @Override public int hashCode() { int hash = 0; hash += (codepresence != null ? codepresence.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Presence)) { return false; } Presence other = (Presence) object; if ((this.codepresence == null && other.codepresence != null) || (this.codepresence != null && !this.codepresence.equals(other.codepresence))) { return false; } return true; } @Override public String toString() { return "projetfinale.ejb.entites.Presence[codepresence=" + codepresence + "]"; } }
L class ETCode:
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 projetfinale.ejb.entites; import java.io.Serializable; import java.util.Collection; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; /** * * @author lefennec */ @Entity @Table(name = "CLASSE") @NamedQueries({@NamedQuery(name = "Classe.findByCodeclasse", query = "SELECT c FROM Classe c WHERE c.codeclasse = :codeclasse"), @NamedQuery(name = "Classe.findByLibelleclasse", query = "SELECT c FROM Classe c WHERE c.libelleclasse = :libelleclasse"), @NamedQuery(name = "Classe.findByNomprofclasse", query = "SELECT c FROM Classe c WHERE c.nomprofclasse = :nomprofclasse")}) public class Classe implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "CODECLASSE", nullable = false) private String codeclasse; @Column(name = "LIBELLECLASSE") private String libelleclasse; @Column(name = "NOMPROFCLASSE") private String nomprofclasse; @JoinColumn(name = "CODEDPT", referencedColumnName = "CODEDPT") @ManyToOne private Departement codedpt; @OneToMany(mappedBy = "codeclasse") private Collection<Et> etCollection; @OneToMany(mappedBy = "codeclasse") private Collection<Cours> coursCollection; @OneToMany(mappedBy = "codeclasse") private Collection<Presence> presenceCollection; public Classe() { } public Classe(String codeclasse) { this.codeclasse = codeclasse; } public String getCodeclasse() { return codeclasse; } public void setCodeclasse(String codeclasse) { this.codeclasse = codeclasse; } public String getLibelleclasse() { return libelleclasse; } public void setLibelleclasse(String libelleclasse) { this.libelleclasse = libelleclasse; } public String getNomprofclasse() { return nomprofclasse; } public void setNomprofclasse(String nomprofclasse) { this.nomprofclasse = nomprofclasse; } public Departement getCodedpt() { return codedpt; } public void setCodedpt(Departement codedpt) { this.codedpt = codedpt; } public Collection<Et> getEtCollection() { return etCollection; } public void setEtCollection(Collection<Et> etCollection) { this.etCollection = etCollection; } public Collection<Cours> getCoursCollection() { return coursCollection; } public void setCoursCollection(Collection<Cours> coursCollection) { this.coursCollection = coursCollection; } public Collection<Presence> getPresenceCollection() { return presenceCollection; } public void setPresenceCollection(Collection<Presence> presenceCollection) { this.presenceCollection = presenceCollection; } @Override public int hashCode() { int hash = 0; hash += (codeclasse != null ? codeclasse.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Classe)) { return false; } Classe other = (Classe) object; if ((this.codeclasse == null && other.codeclasse != null) || (this.codeclasse != null && !this.codeclasse.equals(other.codeclasse))) { return false; } return true; } @Override public String toString() { return "projetfinale.ejb.entites.Classe[codeclasse=" + codeclasse + "]"; } }
apres la creation des EJP entity comment creer des JPA/hibernete pour le mapping (insertion,suppresion,mise a jour) avec la base de donne mysqlCode:
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 package projetfinale.ejb.entites; import java.io.Serializable; import java.util.Collection; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * * @author lefennec */ @Entity @Table(name = "ET") @NamedQueries({@NamedQuery(name = "Et.findByCodeet", query = "SELECT e FROM Et e WHERE e.codeet = :codeet"), @NamedQuery(name = "Et.findByDatedebutet", query = "SELECT e FROM Et e WHERE e.datedebutet = :datedebutet"), @NamedQuery(name = "Et.findByDatefinet", query = "SELECT e FROM Et e WHERE e.datefinet = :datefinet")}) public class Et implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "CODEET", nullable = false) private String codeet; @Column(name = "DATEDEBUTET") @Temporal(TemporalType.DATE) private Date datedebutet; @Column(name = "DATEFINET") @Temporal(TemporalType.DATE) private Date datefinet; @JoinTable(name = "ETJOURCOURS", joinColumns = {@JoinColumn(name = "CODEET", referencedColumnName = "CODEET")}, inverseJoinColumns = {@JoinColumn(name = "DATEJC", referencedColumnName = "DATEJC")}) @ManyToMany private Collection<Jourcours> datejcCollection; @JoinColumn(name = "CODECLASSE", referencedColumnName = "CODECLASSE") @ManyToOne private Classe codeclasse; @JoinColumn(name = "CODEDPT", referencedColumnName = "CODEDPT") @ManyToOne private Departement codedpt; public Et() { } public Et(String codeet) { this.codeet = codeet; } public String getCodeet() { return codeet; } public void setCodeet(String codeet) { this.codeet = codeet; } public Date getDatedebutet() { return datedebutet; } public void setDatedebutet(Date datedebutet) { this.datedebutet = datedebutet; } public Date getDatefinet() { return datefinet; } public void setDatefinet(Date datefinet) { this.datefinet = datefinet; } public Collection<Jourcours> getDatejcCollection() { return datejcCollection; } public void setDatejcCollection(Collection<Jourcours> datejcCollection) { this.datejcCollection = datejcCollection; } public Classe getCodeclasse() { return codeclasse; } public void setCodeclasse(Classe codeclasse) { this.codeclasse = codeclasse; } public Departement getCodedpt() { return codedpt; } public void setCodedpt(Departement codedpt) { this.codedpt = codedpt; } @Override public int hashCode() { int hash = 0; hash += (codeet != null ? codeet.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Et)) { return false; } Et other = (Et) object; if ((this.codeet == null && other.codeet != null) || (this.codeet != null && !this.codeet.equals(other.codeet))) { return false; } return true; } @Override public String toString() { return "projetfinale.ejb.entites.Et[codeet=" + codeet + "]"; } }
http://www.laliluna.de/articles/ejb-...ial-jboss.html
a partir du titre "Stateless Session Bean" tu aura un exemple.
dans les tuto netbeans aussi mais je ne le trouve pas, Netbeans permette la création de beans session avec pas mal de truc déjà fait en automatique je ne sais plus exactement ou c'est pas contre
merci pour la réponse
mais je cherche des document qui traite ces notion(EJB, hibernate/jpa,stricts,glassfish) mais surtout avec netbeans car il y'a une grande difference entre eclipse et netbeans surtout que eclipse nécessite toujours de telecharger des plugins pour faire fonctionner un tel framwork
pour ce que concerne mon appilcation tu veux que je te donne les autre EJB entity qui je créer pour avoir l'idée complète sur mon application et les relations possibles entre tous les class pour qu'on puisse attaque une autre partie de développement de mon application
merci d'avance