Bonjour,
Je travail sur un projet JSF+Hibernate (Oracle comme base de données).
J'ai besoin de faire du statistique, pour cela j'ai choisis d'utiliser l'outil IReport avec sa version 4.1.1.
j'ai crée un nouveau report de type BlankA4 ensuite j'ai voulu ajouter un DataSet de DataSource Hibernate Connection sachant que j'ai ajouter le dossier conteant mon fichier de configuration Hibernate, le Jar JDBC d'Oracle (ojdbc6.jar) et même le dossier contenant les classe Java à mapper à la CLASSPATH et J'ai téléchargé les plugins Hibernate Support et Hibernate Web pour IReport.
Mais en fesant le test de la connexion j'ai eu l'erreur suivante:
Fichier de configuration Hibernate:Unable to load class declared as <mapping class="fr.jsf.entity.Application" /> in the configuration:
Classe Application.java
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 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.connection.driver_class">org.hibernate.dialect.OracleDialect</property> <property name="hibernate.connection.password">geddba</property> <property name="hibernate.connection.url">jdbc:oracle:thin:@192.1.1.71:1521:mgp</property> <property name="hibernate.connection.username">gedmgpdba</property> <property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property> <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property> <property name="hibernate.default_schema">gedmgpdba</property> <property name="current_session_context_class">thread</property> <property name="hibernate.hbm2ddl.auto">update</property> <property name="show_sql">true</property> <property name="format_sql"/> <property name="generate_statistics"/> <property name="use_sql_comments">true</property> <mapping class="fr.jsf.entity.Application" /> <mapping class="fr.jsf.entity.Parametre" /> </session-factory> </hibernate-configuration>
Classe Parametre.java
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 package fr.jsf.entity; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @Table(name="GEDAPPLICATION") public class Application implements Serializable{ private static final long serialVersionUID = 1L; @Id @Column(name="APPL_ID") private Integer id; @Column(name="APPL_LIBLONG") private String applLiblong; @Column(name="APPL_LIBCOURT") private String applLibcourt; @Column(name="APPL_PLANNING") private Integer applPlannig; @Column(name="APPL_FLAG_ACTIF") private Integer applFlagActif; @Column(name="APPL_GERE_FLUX") private Integer applGereFlux; @Column(name="APPL_PARAM_INSTANCE") private Integer applParamInstance; @Column(name="APPL_SERVICE") private Integer applService; @Column(name="APPL_FLAG_VIRTUEL") private Integer applFlagVirtuel; @OneToMany(mappedBy = "paraApplId", cascade = { CascadeType.ALL }) private List<Parametre> apps = new ArrayList<Parametre>(); public Application(){super();} public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getApplLiblong() { return applLiblong; } public void setApplLiblong(String ApplLiblong) { this.applLiblong = ApplLiblong; } public List<Parametre> getApps() { return apps; } public void setApps(List<Parametre> apps) { this.apps = apps; } public String getApplLibcourt() { return applLibcourt; } public void setApplLibcourt(String applLibcourt) { this.applLibcourt = applLibcourt; } public Integer getApplPlannig() { return applPlannig; } public void setApplPlannig(Integer applPlannig) { this.applPlannig = applPlannig; } public Integer getApplFlagActif() { return applFlagActif; } public void setApplFlagActif(Integer applFlagActif) { this.applFlagActif = applFlagActif; } public Integer getApplGereFlux() { return applGereFlux; } public void setApplGereFlux(Integer applGereFlux) { this.applGereFlux = applGereFlux; } public Integer getApplParamInstance() { return applParamInstance; } public void setApplParamInstance(Integer applParamInstance) { this.applParamInstance = applParamInstance; } public Integer getApplService() { return applService; } public void setApplService(Integer applService) { this.applService = applService; } public Integer getApplFlagVirtuel() { return applFlagVirtuel; } public void setApplFlagVirtuel(Integer applFlagVirtuel) { this.applFlagVirtuel = applFlagVirtuel; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((applFlagActif == null) ? 0 : applFlagActif.hashCode()); result = prime * result + ((applFlagVirtuel == null) ? 0 : applFlagVirtuel.hashCode()); result = prime * result + ((applGereFlux == null) ? 0 : applGereFlux.hashCode()); result = prime * result + ((applLibcourt == null) ? 0 : applLibcourt.hashCode()); result = prime * result + ((applLiblong == null) ? 0 : applLiblong.hashCode()); result = prime * result + ((applParamInstance == null) ? 0 : applParamInstance .hashCode()); result = prime * result + ((applPlannig == null) ? 0 : applPlannig.hashCode()); result = prime * result + ((applService == null) ? 0 : applService.hashCode()); result = prime * result + ((apps == null) ? 0 : apps.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Application other = (Application) obj; if (applFlagActif == null) { if (other.applFlagActif != null) return false; } else if (!applFlagActif.equals(other.applFlagActif)) return false; if (applFlagVirtuel == null) { if (other.applFlagVirtuel != null) return false; } else if (!applFlagVirtuel.equals(other.applFlagVirtuel)) return false; if (applGereFlux == null) { if (other.applGereFlux != null) return false; } else if (!applGereFlux.equals(other.applGereFlux)) return false; if (applLibcourt == null) { if (other.applLibcourt != null) return false; } else if (!applLibcourt.equals(other.applLibcourt)) return false; if (applLiblong == null) { if (other.applLiblong != null) return false; } else if (!applLiblong.equals(other.applLiblong)) return false; if (applParamInstance == null) { if (other.applParamInstance != null) return false; } else if (!applParamInstance.equals(other.applParamInstance)) return false; if (applPlannig == null) { if (other.applPlannig != null) return false; } else if (!applPlannig.equals(other.applPlannig)) return false; if (applService == null) { if (other.applService != null) return false; } else if (!applService.equals(other.applService)) return false; if (apps == null) { if (other.apps != null) return false; } else if (!apps.equals(other.apps)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }
J'utilise Hibernate 3.6.7 et l'implementation MyFaces 2.0.7 et JasperReports 4.1.1
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 package fr.jsf.entity; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; @Entity @Table(name="GEDPARAMETRAGE") public class Parametre implements Serializable{ private static final long serialVersionUID = 1L; @Id @Column(name="PARA_MOTCLE") private String id; @Column(name="PARA_TEXTE1") private String paraTexte1; @Column(name="PARA_DESCRIPTION") private String paraDescription; @Column(name="PARA_NUM1") private Integer paraNum1; @Column(name="PARA_NUM2") private Integer paraNum2; @Column(name="PARA_ADMINISTRABLE",nullable=false) private Integer paraAdministrable; @Column(name="PARA_FLAG_FONC") private Integer paraFlagFonc; @Column(name="PARA_FLAG_TECH") private Integer paraFlagTech; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name = "PARA_APPL_ID", nullable = false) private Application paraApplId; public Parametre(){} public String getId() { return id; } public void setId(String id) { this.id = id; } public Application getParaApplId() { return paraApplId; } public void setParaApplId(Application paraApplId) { this.paraApplId = paraApplId; } public String getParaTexte1() { return paraTexte1; } public void setParaTexte1(String paraTexte1) { this.paraTexte1 = paraTexte1; } public String getParaDescription() { return paraDescription; } public void setParaDescription(String paraDescription) { this.paraDescription = paraDescription; } public Integer getParaNum1() { return paraNum1; } public void setParaNum1(Integer paraNum1) { this.paraNum1 = paraNum1; } public Integer getParaNum2() { return paraNum2; } public void setParaNum2(Integer paraNum2) { this.paraNum2 = paraNum2; } public Integer getParaFlagFonc() { return paraFlagFonc; } public void setParaFlagFonc(Integer paraFlagFonc) { this.paraFlagFonc = paraFlagFonc; } public Integer getParaFlagTech() { return paraFlagTech; } public void setParaFlagTech(Integer paraFlagTech) { this.paraFlagTech = paraFlagTech; } public Integer getParaAdministrable() { return paraAdministrable; } public void setParaAdministrable(Integer paraAdministrable) { this.paraAdministrable = paraAdministrable; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((paraAdministrable == null) ? 0 : paraAdministrable .hashCode()); result = prime * result + ((paraApplId == null) ? 0 : paraApplId.hashCode()); result = prime * result + ((paraDescription == null) ? 0 : paraDescription.hashCode()); result = prime * result + ((paraFlagFonc == null) ? 0 : paraFlagFonc.hashCode()); result = prime * result + ((paraFlagTech == null) ? 0 : paraFlagTech.hashCode()); result = prime * result + ((paraNum1 == null) ? 0 : paraNum1.hashCode()); result = prime * result + ((paraNum2 == null) ? 0 : paraNum2.hashCode()); result = prime * result + ((paraTexte1 == null) ? 0 : paraTexte1.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Parametre other = (Parametre) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (paraAdministrable == null) { if (other.paraAdministrable != null) return false; } else if (!paraAdministrable.equals(other.paraAdministrable)) return false; if (paraApplId == null) { if (other.paraApplId != null) return false; } else if (!paraApplId.equals(other.paraApplId)) return false; if (paraDescription == null) { if (other.paraDescription != null) return false; } else if (!paraDescription.equals(other.paraDescription)) return false; if (paraFlagFonc == null) { if (other.paraFlagFonc != null) return false; } else if (!paraFlagFonc.equals(other.paraFlagFonc)) return false; if (paraFlagTech == null) { if (other.paraFlagTech != null) return false; } else if (!paraFlagTech.equals(other.paraFlagTech)) return false; if (paraNum1 == null) { if (other.paraNum1 != null) return false; } else if (!paraNum1.equals(other.paraNum1)) return false; if (paraNum2 == null) { if (other.paraNum2 != null) return false; } else if (!paraNum2.equals(other.paraNum2)) return false; if (paraTexte1 == null) { if (other.paraTexte1 != null) return false; } else if (!paraTexte1.equals(other.paraTexte1)) return false; return true; } }
Merci d'avance pour vos réponses.
Partager