bonjour tout le monde
je veux traduire ma requette sql suivante en hql car le createSQLQuery ne marche pas pour moi
voici ma requette
aidez moi SVPCode:select * from reclamation where date_cre +interval'3 days'>=CURRENT_TIMESTAMP
Version imprimable
bonjour tout le monde
je veux traduire ma requette sql suivante en hql car le createSQLQuery ne marche pas pour moi
voici ma requette
aidez moi SVPCode:select * from reclamation where date_cre +interval'3 days'>=CURRENT_TIMESTAMP
Date a = new Date ("date_cre");
Date b = new Date ("");
en java :
a + 3 day
fromp reclamation where a >= b
mais date_cre est une colonne de la table
Tu peux nous montrer le mapping de ces classes?
le classe de mapping Reclamation est
et le fichier de mapping Reclamation.hbm.xml estCode:
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 package mapping; import java.util.Date; /** * AbstractReclamation entity provides the base persistence definition of the * Reclamation entity. * * @author MyEclipse Persistence Tools */ public abstract class AbstractReclamation implements java.io.Serializable { // Fields private Integer numRec; private Equipement equipement; private Societe societe; private Responsable responsable; private Utilisateur utilisateur; private String descrip; private Date dateCre; private String typeProbl; private String qualif; private Date dateInter; private Date dateSol; private String objet; private String observation; private String statut; // Constructors /** default constructor */ public AbstractReclamation() { } /** minimal constructor */ public AbstractReclamation(Integer numRec, Responsable responsable, Utilisateur utilisateur) { this.numRec = numRec; this.responsable = responsable; this.utilisateur = utilisateur; } /** full constructor */ public AbstractReclamation(Integer numRec, Equipement equipement, Societe societe, Responsable responsable, Utilisateur utilisateur, String descrip, Date dateCre, String typeProbl, String qualif, Date dateInter, Date dateSol, String objet,String observation, String statut) { this.numRec = numRec; this.equipement = equipement; this.societe = societe; this.responsable = responsable; this.utilisateur = utilisateur; this.descrip = descrip; this.dateCre = dateCre; this.typeProbl = typeProbl; this.qualif = qualif; this.dateInter = dateInter; this.dateSol = dateSol; this.objet = objet; this.observation=observation; this.statut = statut; } // Property accessors public Integer getNumRec() { return this.numRec; } public void setNumRec(Integer numRec) { this.numRec = numRec; } public Equipement getEquipement() { return this.equipement; } public void setEquipement(Equipement equipement) { this.equipement = equipement; } public Societe getSociete() { return this.societe; } public void setSociete(Societe societe) { this.societe = societe; } public Responsable getResponsable() { return this.responsable; } public void setResponsable(Responsable responsable) { this.responsable = responsable; } public Utilisateur getUtilisateur() { return this.utilisateur; } public void setUtilisateur(Utilisateur utilisateur) { this.utilisateur = utilisateur; } public String getDescrip() { return this.descrip; } public void setDescrip(String descrip) { this.descrip = descrip; } public Date getDateCre() { return this.dateCre; } public void setDateCre(Date dateCre) { this.dateCre = dateCre; } public String getTypeProbl() { return this.typeProbl; } public void setTypeProbl(String typeProbl) { this.typeProbl = typeProbl; } public String getQualif() { return this.qualif; } public void setQualif(String qualif) { this.qualif = qualif; } public Date getDateInter() { return this.dateInter; } public void setDateInter(Date dateInter) { this.dateInter = dateInter; } public Date getDateSol() { return this.dateSol; } public void setDateSol(Date dateSol) { this.dateSol = dateSol; } public String getObjet() { return this.objet; } public void setObjet(String objet) { this.objet = objet; } public String getStatut() { return this.statut; } public void setStatut(String statut) { this.statut = statut; } public String getObservation() { return observation; } public void setObservation(String observation) { this.observation = observation; } }
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 <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Mapping file autogenerated by MyEclipse Persistence Tools --> <hibernate-mapping> <class name="mapping.Reclamation" table="reclamation" schema="public"> <id name="numRec" type="java.lang.Integer"> <column name="num_rec" /> <generator class="increment" /> </id> <many-to-one name="equipement" class="mapping.Equipement" fetch="select"> <column name="num_serie" length="20" /> </many-to-one> <many-to-one name="societe" class="mapping.Societe" fetch="select"> <column name="id_sc" /> </many-to-one> <many-to-one name="responsable" class="mapping.Responsable" fetch="select"> <column name="matr_resp" length="20" /> </many-to-one> <many-to-one name="utilisateur" class="mapping.Utilisateur" fetch="select"> <column name="matricul" length="20" /> </many-to-one> <property name="descrip" type="java.lang.String"> <column name="descrip" length="200" /> </property> <property name="dateCre" type="java.util.Date"> <column name="date_cre" length="13" /> </property> <property name="typeProbl" type="java.lang.String"> <column name="type_probl" length="30" /> </property> <property name="qualif" type="java.lang.String"> <column name="qualif" length="40" /> </property> <property name="dateInter" type="java.util.Date"> <column name="date_inter" length="13" /> </property> <property name="dateSol" type="java.util.Date"> <column name="date_sol" length="13" /> </property> <property name="objet" type="java.lang.String"> <column name="objet" length="80" /> </property> <property name="observation" type="java.lang.String"> <column name="observation" length="50" /> </property> <property name="statut" type="java.lang.String"> <column name="statut" length="10" /> </property> </class> </hibernate-mapping>