bonjour,

j'aimerais pouvoir récupérer les collections d'objet de mes entity JPA bidirectionnel via un service web .
je suis sous maven jersey et j'utilise org.glassfish.jersey.media mais une fois que j’enlève le @XmlTransient .
j'ai une erreur Etat HTTP 500 - Internal Server Error alors j'aurais voulu savoir comment faire ?

Merci d'avance :

j'ai les entity suivantes :


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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
 
 
@Entity
@Table(name = "Personne")
@XmlRootElement
 
public class Personne implements Serializable {
 
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "KeyPersonne")
    private Integer keyPersonne;
    @Size(max = 255)
    @Column(name = "Actif")
    private String actif;
    @Column(name = "DateCreation")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateCreation;
    @Column(name = "DateModification")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateModification;
    // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
    @Size(max = 255)
    @Column(name = "Email")
    private String email;
    // @Pattern(regexp="^\\(?(\\d{3})\\)?[- ]?(\\d{3})[- ]?(\\d{4})$", message="Invalid phone/fax format, should be as xxx-xxx-xxxx")//if the field contains phone or fax number consider using this annotation to enforce field validation
    @Size(max = 255)
    @Column(name = "Fax")
    private String fax;
    @ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "keyCivilite")
    private Civilite civilite;
    @ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "keySociete")
    private Societe societe;
    @Size(max = 255)
    @Column(name = "Nom")
    private String nom;
    @Size(max = 255)
    @Column(name = "Portable")
    private String portable;
    @Size(max = 255)
    @Column(name = "Prenom")
    private String prenom;
    @Size(max = 255)
    @Column(name = "Telephone")
    private String telephone;
    @ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "KeyTypeUser")
    private TypeUser typeUser;
    //@XmlInverseReference(mappedBy = "Login")
    //@XmlElementWrapper(name="Login")
    @OneToMany(mappedBy = "personne",cascade = CascadeType.ALL,fetch = FetchType.EAGER)
    private Collection<Login> loginCollection;
    @OneToMany(mappedBy = "personne",cascade = CascadeType.ALL)
    private Collection<Droit> droitCollection;
    @OneToMany(mappedBy = "personne",cascade = CascadeType.ALL  )
    private Collection<Projet> projetCollection;
    @OneToMany(mappedBy = "personne",cascade = CascadeType.ALL)
    private Collection<Prospection> prospectionCollection;
    @OneToMany(mappedBy = "commercial",cascade = CascadeType.ALL)
    private Collection<Prospection> ClientCollection;
 
    public Integer getKeyPersonne() {
        return keyPersonne;
    }
 
    public void setKeyPersonne(Integer keyPersonne) {
        this.keyPersonne = keyPersonne;
    }
 
    public String getActif() {
        return actif;
    }
 
    public void setActif(String actif) {
        this.actif = actif;
    }
 
    public Date getDateCreation() {
        return dateCreation;
    }
 
    public void setDateCreation(Date dateCreation) {
        this.dateCreation = dateCreation;
    }
 
    public Date getDateModification() {
        return dateModification;
    }
 
    public void setDateModification(Date dateModification) {
        this.dateModification = dateModification;
    }
 
    public String getEmail() {
        return email;
    }
 
    public void setEmail(String email) {
        this.email = email;
    }
 
    public String getFax() {
        return fax;
    }
 
    public void setFax(String fax) {
        this.fax = fax;
    }
 
    public Civilite getCivilite() {
        return civilite;
    }
 
    public void setCivilite(Civilite civilite) {
        this.civilite = civilite;
    }
 
    public Societe getSociete() {
        return societe;
    }
 
    public void setSociete(Societe societe) {
        this.societe = societe;
    }
 
    public String getNom() {
        return nom;
    }
 
    public void setNom(String nom) {
        this.nom = nom;
    }
 
    public String getPortable() {
        return portable;
    }
 
    public void setPortable(String portable) {
        this.portable = portable;
    }
 
    public String getPrenom() {
        return prenom;
    }
 
    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }
 
    public String getTelephone() {
        return telephone;
    }
 
    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }
 
    public TypeUser getTypeUser() {
        return typeUser;
    }
 
    public void setTypeUser(TypeUser typeUser) {
        this.typeUser = typeUser;
    }
    @XmlTransient
    public Collection<Login> getLoginCollection() {
        return loginCollection;
    }
 
    public void setLoginCollection(Collection<Login> loginCollection) {
        this.loginCollection = loginCollection;
    }
     @XmlTransient
    public Collection<Droit> getDroitCollection() {
        return droitCollection;
    }
 
    public void setDroitCollection(Collection<Droit> droitCollection) {
        this.droitCollection = droitCollection;
    }
     @XmlTransient
    public Collection<Projet> getProjetCollection() {
        return projetCollection;
    }
 
    public void setProjetCollection(Collection<Projet> projetCollection) {
        this.projetCollection = projetCollection;
    }
     @XmlTransient
    public Collection<Prospection> getProspectionCollection() {
        return prospectionCollection;
    }
 
    public void setProspectionCollection(Collection<Prospection> prospectionCollection) {
        this.prospectionCollection = prospectionCollection;
    }
     @XmlTransient
    public Collection<Prospection> getClientCollection() {
        return ClientCollection;
    }
 
    public void setClientCollection(Collection<Prospection> ClientCollection) {
        this.ClientCollection = ClientCollection;
    }
 
 
 
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (keyPersonne != null ? keyPersonne.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 Personne)) {
            return false;
        }
        Personne other = (Personne) object;
        if ((this.keyPersonne == null && other.keyPersonne != null) || (this.keyPersonne != null && !this.keyPersonne.equals(other.keyPersonne))) {
            return false;
        }
        return true;
    }
 
    @Override
    public String toString() {
        return "fr.ietevents.serviceweb.Entity.Personne[ keyPersonne=" + keyPersonne + " ]";
    }
 
}
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
 
 
 
@Entity
@Table(name = "Login")
@XmlRootElement
public class Login implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "KeyLogin")
    private Integer keyLogin;
    @Size(max = 255)
    @Column(name = "Actif")
    private String actif;
    @Column(name = "DateCreation")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateCreation;
    @Size(max = 255)
    @Column(name = "Login")
    private String login;
    @Size(max = 255)
    @Column(name = "Password")
    private String password;
    @ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "KeyPersonne")
    private Personne personne;
 
    public Login() {
    }
 
    public Login(Integer keyLogin) {
        this.keyLogin = keyLogin;
    }
 
    public Integer getKeyLogin() {
        return keyLogin;
    }
 
    public void setKeyLogin(Integer keyLogin) {
        this.keyLogin = keyLogin;
    }
 
    public String getActif() {
        return actif;
    }
 
    public void setActif(String actif) {
        this.actif = actif;
    }
 
    public Date getDateCreation() {
        return dateCreation;
    }
 
    public void setDateCreation(Date dateCreation) {
        this.dateCreation = dateCreation;
    }
 
    public String getLogin() {
        return login;
    }
 
    public void setLogin(String login) {
        this.login = login;
    }
 
    public String getPassword() {
        return password;
    }
 
    public void setPassword(String password) {
        this.password = password;
    }
 
    public Personne getPersonne() {
        return personne;
    }
 
    public void setPersonne(Personne personne) {
        this.personne = personne;
    }
 
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (keyLogin != null ? keyLogin.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 Login)) {
            return false;
        }
        Login other = (Login) object;
        if ((this.keyLogin == null && other.keyLogin != null) || (this.keyLogin != null && !this.keyLogin.equals(other.keyLogin))) {
            return false;
        }
        return true;
    }
 
    @Override
    public String toString() {
        return "fr.ietevents.serviceweb.Entity.Login[ keyLogin=" + keyLogin + " ]";
    }
 
}