Bonjour
J'essaie de porter un projet struts2 / hibernate lourd et tout bogué sur JEE6 CDI avec JSF2.
L'application consiste à créer des dérogations concernant une chaîne de fabrication. Un des principes de l'application est de pouvoir lier plusieurs produits fabriqués à la dérogation.

Je vais commencer par le début.
Comment était ce fait avec Struts2 ?
Les produits devant être liés avant l'insertion de la dérogation, un id était généré à l'appel du formulaire. Cet id contenu dans un champ hidden était repris pour insérer le produit.

[IMG][/IMG]

Voici le SQL :

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
CREATE TABLE `derogation` (
  `id` varchar(150) NOT NULL,
  `description` text NOT NULL,
  `status` varchar(1) DEFAULT NULL,
  `type1` int(11) DEFAULT NULL,
  `type2` int(11) DEFAULT NULL,
  `type3` int(11) DEFAULT NULL,
  `emetteur` varchar(255) DEFAULT NULL,
  `emetteur_email` varchar(255) DEFAULT NULL,
  `service` varchar(70) DEFAULT NULL,
  `date_emission` varchar(50) DEFAULT NULL,
  `client` int(11) DEFAULT NULL,
  `vehicule` varchar(255) DEFAULT NULL,
  `responsable_qualite` varchar(255) DEFAULT NULL,
  `responsable_qualite_email` varchar(255) DEFAULT NULL,
  `description_standard` text,
  `description_reel` text,
  `description_origine` text,
  `acceptee` tinyint(1) DEFAULT '0',
  `date_acceptee` varchar(50) DEFAULT NULL,
  `raison_refus` text,
  `non_conformite` tinyint(1) DEFAULT '0',
  `nonconformite_number` varchar(150) DEFAULT NULL,
  `autorisation_client` tinyint(1) DEFAULT '0',
  `information_client` tinyint(1) DEFAULT '0',
  `liste_diffusion` varchar(150) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `client` (`client`),
  KEY `responsable_qualite` (`responsable_qualite`),
  KEY `emetteur` (`emetteur`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
CREATE TABLE `produit` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `reference` varchar(255) DEFAULT NULL,
  `designation` varchar(255) DEFAULT NULL,
  `emetteur` varchar(150) DEFAULT NULL,
  `quantite` varchar(10) DEFAULT NULL,
  `fabrique` tinyint(1) DEFAULT '0',
  `validite` varchar(50) DEFAULT NULL,
  `famille` int(11) DEFAULT NULL,
  `fournisseur` int(11) DEFAULT NULL,
  `derogation` varchar(150) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `famille` (`famille`),
  KEY `fournisseur` (`fournisseur`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;
Si la dérogation n'était finalement pas sauvegardée (abandon du formulaire), le produit se retrouvait orphelin dans la base de données.

JEE6
J'ai cru comprendre que JEE6 pouvait me simplifier tout ça, mais j'ai vraiment du mal à en capter le principe des relations vu la différence de fonctionnement avec Struts2.

Voici le SQL de la nouvelle base générée par Eclipselink :

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
CREATE TABLE IF NOT EXISTS `deviation` (
  `ID` varchar(255) NOT NULL,
  `AUTHORIZATIONCLIENT` tinyint(1) DEFAULT '0',
  `INFORMATIONCLIENT` tinyint(1) DEFAULT '0',
  `MANAGER` varchar(255) DEFAULT NULL,
  `MANAGEREMAIL` varchar(255) DEFAULT NULL,
  `ORIGINDESCRIPTION` varchar(255) DEFAULT NULL,
  `REALDESCRIPTION` varchar(255) DEFAULT NULL,
  `REQUESTDATE` varchar(255) DEFAULT NULL,
  `REQUESTER` varchar(255) DEFAULT NULL,
  `REQUESTEREMAIL` varchar(255) DEFAULT NULL,
  `STANDARDDESCRIPTION` varchar(255) DEFAULT NULL,
  `STATUS` int(11) DEFAULT NULL,
  `TITLE` text NOT NULL,
  `TYPE1` int(11) DEFAULT NULL,
  `TYPE2` int(11) DEFAULT NULL,
  `TYPE3` int(11) DEFAULT NULL,
  `VALIDATEDDATE` varchar(255) DEFAULT NULL,
  `VEHICLETITLE` varchar(255) DEFAULT NULL,
  `CLIENT_ID` int(11) DEFAULT NULL,
  `DEPARTMENT_ID` int(11) DEFAULT NULL,
  `DIFFUSIONLIST_ID` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`),
  KEY `FK_DEVIATION_DIFFUSIONLIST_ID` (`DIFFUSIONLIST_ID`),
  KEY `FK_DEVIATION_DEPARTMENT_ID` (`DEPARTMENT_ID`),
  KEY `FK_DEVIATION_CLIENT_ID` (`CLIENT_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
CREATE TABLE IF NOT EXISTS `product` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `DEVIATION` varchar(255) NOT NULL,
  `QUANTITY` int(11) DEFAULT NULL,
  `REFERENCE` varchar(255) DEFAULT NULL,
  `REQUESTER` varchar(255) DEFAULT NULL,
  `TITLE` varchar(255) DEFAULT NULL,
  `VALIDITYDATE` varchar(255) DEFAULT NULL,
  `FAMILY_ID` int(11) DEFAULT NULL,
  `SUPPLIER_ID` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`),
  KEY `FK_PRODUCT_FAMILY_ID` (`FAMILY_ID`),
  KEY `FK_PRODUCT_SUPPLIER_ID` (`SUPPLIER_ID`),
  KEY `DEVIATION` (`DEVIATION`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Le bean entity pour la table "deviation" :

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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aml.deviations.entity;
 
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
 
@Entity
@Table(name = "deviation")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Deviation.findAll", query = "SELECT d FROM Deviation d"),
    @NamedQuery(name = "Deviation.findById", query = "SELECT d FROM Deviation d WHERE d.id = :id"),
    @NamedQuery(name = "Deviation.findByAuthorizationclient", query = "SELECT d FROM Deviation d WHERE d.authorizationclient = :authorizationclient"),
    @NamedQuery(name = "Deviation.findByInformationclient", query = "SELECT d FROM Deviation d WHERE d.informationclient = :informationclient"),
    @NamedQuery(name = "Deviation.findByManager", query = "SELECT d FROM Deviation d WHERE d.manager = :manager"),
    @NamedQuery(name = "Deviation.findByManageremail", query = "SELECT d FROM Deviation d WHERE d.manageremail = :manageremail"),
    @NamedQuery(name = "Deviation.findByOrigindescription", query = "SELECT d FROM Deviation d WHERE d.origindescription = :origindescription"),
    @NamedQuery(name = "Deviation.findByRealdescription", query = "SELECT d FROM Deviation d WHERE d.realdescription = :realdescription"),
    @NamedQuery(name = "Deviation.findByRequestdate", query = "SELECT d FROM Deviation d WHERE d.requestdate = :requestdate"),
    @NamedQuery(name = "Deviation.findByRequester", query = "SELECT d FROM Deviation d WHERE d.requester = :requester"),
    @NamedQuery(name = "Deviation.findByRequesteremail", query = "SELECT d FROM Deviation d WHERE d.requesteremail = :requesteremail"),
    @NamedQuery(name = "Deviation.findByStandarddescription", query = "SELECT d FROM Deviation d WHERE d.standarddescription = :standarddescription"),
    @NamedQuery(name = "Deviation.findByStatus", query = "SELECT d FROM Deviation d WHERE d.status = :status"),
    @NamedQuery(name = "Deviation.findByType1", query = "SELECT d FROM Deviation d WHERE d.type1 = :type1"),
    @NamedQuery(name = "Deviation.findByType2", query = "SELECT d FROM Deviation d WHERE d.type2 = :type2"),
    @NamedQuery(name = "Deviation.findByType3", query = "SELECT d FROM Deviation d WHERE d.type3 = :type3"),
    @NamedQuery(name = "Deviation.findByValidateddate", query = "SELECT d FROM Deviation d WHERE d.validateddate = :validateddate"),
    @NamedQuery(name = "Deviation.findByVehicletitle", query = "SELECT d FROM Deviation d WHERE d.vehicletitle = :vehicletitle")})
public class Deviation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "ID")
    private String id;
    @Column(name = "AUTHORIZATIONCLIENT")
    private Boolean authorizationclient;
    @Column(name = "INFORMATIONCLIENT")
    private Boolean informationclient;
    @Size(max = 255)
    @Column(name = "MANAGER")
    private String manager;
    @Size(max = 255)
    @Column(name = "MANAGEREMAIL")
    private String manageremail;
    @Size(max = 255)
    @Column(name = "ORIGINDESCRIPTION")
    private String origindescription;
    @Size(max = 255)
    @Column(name = "REALDESCRIPTION")
    private String realdescription;
    @Size(max = 255)
    @Column(name = "REQUESTDATE")
    private String requestdate;
    @Size(max = 255)
    @Column(name = "REQUESTER")
    private String requester;
    @Size(max = 255)
    @Column(name = "REQUESTEREMAIL")
    private String requesteremail;
    @Size(max = 255)
    @Column(name = "STANDARDDESCRIPTION")
    private String standarddescription;
    @Column(name = "STATUS")
    private Integer status;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 65535)
    @Column(name = "TITLE")
    private String title;
    @Column(name = "TYPE1")
    private Integer type1;
    @Column(name = "TYPE2")
    private Integer type2;
    @Column(name = "TYPE3")
    private Integer type3;
    @Size(max = 255)
    @Column(name = "VALIDATEDDATE")
    private String validateddate;
    @Size(max = 255)
    @Column(name = "VEHICLETITLE")
    private String vehicletitle;
    @JoinTable(name = "recurrence", joinColumns = {
        @JoinColumn(name = "id_recurrente", referencedColumnName = "ID")}, inverseJoinColumns = {
        @JoinColumn(name = "id_origin", referencedColumnName = "ID")})
    @ManyToMany
    private List<Deviation> deviationList;
    @ManyToMany(mappedBy = "deviationList")
    private List<Deviation> deviationList1;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "deviation")
    private List<Product> productList;
    @JoinColumn(name = "DIFFUSIONLIST_ID", referencedColumnName = "ID")
    @ManyToOne
    private Diffusionlist diffusionlist;
    @JoinColumn(name = "DEPARTMENT_ID", referencedColumnName = "ID")
    @ManyToOne
    private Department department;
    @JoinColumn(name = "CLIENT_ID", referencedColumnName = "ID")
    @ManyToOne
    private Client client;
 
    public Deviation() {
    }
 
    public Deviation(String id) {
        this.id = id;
    }
 
    public Deviation(String id, String title) {
        this.id = id;
        this.title = title;
    }
 
    public String getId() {
        return id;
    }
 
    public void setId(String id) {
        this.id = id;
    }
 
    public Boolean getAuthorizationclient() {
        return authorizationclient;
    }
 
    public void setAuthorizationclient(Boolean authorizationclient) {
        this.authorizationclient = authorizationclient;
    }
 
    public Boolean getInformationclient() {
        return informationclient;
    }
 
    public void setInformationclient(Boolean informationclient) {
        this.informationclient = informationclient;
    }
 
    public String getManager() {
        return manager;
    }
 
    public void setManager(String manager) {
        this.manager = manager;
    }
 
    public String getManageremail() {
        return manageremail;
    }
 
    public void setManageremail(String manageremail) {
        this.manageremail = manageremail;
    }
 
    public String getOrigindescription() {
        return origindescription;
    }
 
    public void setOrigindescription(String origindescription) {
        this.origindescription = origindescription;
    }
 
    public String getRealdescription() {
        return realdescription;
    }
 
    public void setRealdescription(String realdescription) {
        this.realdescription = realdescription;
    }
 
    public String getRequestdate() {
        return requestdate;
    }
 
    public void setRequestdate(String requestdate) {
        this.requestdate = requestdate;
    }
 
    public String getRequester() {
        return requester;
    }
 
    public void setRequester(String requester) {
        this.requester = requester;
    }
 
    public String getRequesteremail() {
        return requesteremail;
    }
 
    public void setRequesteremail(String requesteremail) {
        this.requesteremail = requesteremail;
    }
 
    public String getStandarddescription() {
        return standarddescription;
    }
 
    public void setStandarddescription(String standarddescription) {
        this.standarddescription = standarddescription;
    }
 
    public Integer getStatus() {
        return status;
    }
 
    public void setStatus(Integer status) {
        this.status = status;
    }
 
    public String getTitle() {
        return title;
    }
 
    public void setTitle(String title) {
        this.title = title;
    }
 
    public Integer getType1() {
        return type1;
    }
 
    public void setType1(Integer type1) {
        this.type1 = type1;
    }
 
    public Integer getType2() {
        return type2;
    }
 
    public void setType2(Integer type2) {
        this.type2 = type2;
    }
 
    public Integer getType3() {
        return type3;
    }
 
    public void setType3(Integer type3) {
        this.type3 = type3;
    }
 
    public String getValidateddate() {
        return validateddate;
    }
 
    public void setValidateddate(String validateddate) {
        this.validateddate = validateddate;
    }
 
    public String getVehicletitle() {
        return vehicletitle;
    }
 
    public void setVehicletitle(String vehicletitle) {
        this.vehicletitle = vehicletitle;
    }
 
    @XmlTransient
    public List<Deviation> getDeviationList() {
        return deviationList;
    }
 
    public void setDeviationList(List<Deviation> deviationList) {
        this.deviationList = deviationList;
    }
 
    @XmlTransient
    public List<Deviation> getDeviationList1() {
        return deviationList1;
    }
 
    public void setDeviationList1(List<Deviation> deviationList1) {
        this.deviationList1 = deviationList1;
    }
 
    @XmlTransient
    public List<Product> getProductList() {
        return productList;
    }
 
    public void setProductList(List<Product> productList) {
        this.productList = productList;
    }
 
    public Diffusionlist getDiffusionlist() {
        return diffusionlist;
    }
 
    public void setDiffusionlist(Diffusionlist diffusionlist) {
        this.diffusionlist = diffusionlist;
    }
 
    public Department getDepartment() {
        return department;
    }
 
    public void setDepartment(Department department) {
        this.department = department;
    }
 
    public Client getClient() {
        return client;
    }
 
    public void setClient(Client client) {
        this.client = client;
    }
 
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.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 Deviation)) {
            return false;
        }
        Deviation other = (Deviation) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }
 
    @Override
    public String toString() {
        return "com.aml.deviations.entity.Deviation[ id=" + id + " ]";
    }
 
}
Le bean entity pour la table "product" :

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
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aml.deviations.entity;
 
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
 
@Entity
@Table(name = "product")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Product.findAll", query = "SELECT p FROM Product p"),
    @NamedQuery(name = "Product.findById", query = "SELECT p FROM Product p WHERE p.id = :id"),
    @NamedQuery(name = "Product.findByQuantity", query = "SELECT p FROM Product p WHERE p.quantity = :quantity"),
    @NamedQuery(name = "Product.findByReference", query = "SELECT p FROM Product p WHERE p.reference = :reference"),
    @NamedQuery(name = "Product.findByRequester", query = "SELECT p FROM Product p WHERE p.requester = :requester"),
    @NamedQuery(name = "Product.findByTitle", query = "SELECT p FROM Product p WHERE p.title = :title"),
    @NamedQuery(name = "Product.findByValiditydate", query = "SELECT p FROM Product p WHERE p.validitydate = :validitydate")})
public class Product implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Column(name = "QUANTITY")
    private Integer quantity;
    @Size(max = 255)
    @Column(name = "REFERENCE")
    private String reference;
    @Size(max = 255)
    @Column(name = "REQUESTER")
    private String requester;
    @Size(max = 255)
    @Column(name = "TITLE")
    private String title;
    @Size(max = 255)
    @Column(name = "VALIDITYDATE")
    private String validitydate;
    @JoinColumn(name = "SUPPLIER_ID", referencedColumnName = "ID")
    @ManyToOne
    private Productsupplier productsupplier;
    @JoinColumn(name = "FAMILY_ID", referencedColumnName = "ID")
    @ManyToOne
    private Productfamily productfamily;
    @JoinColumn(name = "DEVIATION", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private Deviation deviation;
 
    public Product() {
    }
 
    public Product(Integer id) {
        this.id = id;
    }
 
    public Integer getId() {
        return id;
    }
 
    public void setId(Integer id) {
        this.id = id;
    }
 
    public Integer getQuantity() {
        return quantity;
    }
 
    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }
 
    public String getReference() {
        return reference;
    }
 
    public void setReference(String reference) {
        this.reference = reference;
    }
 
    public String getRequester() {
        return requester;
    }
 
    public void setRequester(String requester) {
        this.requester = requester;
    }
 
    public String getTitle() {
        return title;
    }
 
    public void setTitle(String title) {
        this.title = title;
    }
 
    public String getValiditydate() {
        return validitydate;
    }
 
    public void setValiditydate(String validitydate) {
        this.validitydate = validitydate;
    }
 
    public Productsupplier getProductsupplier() {
        return productsupplier;
    }
 
    public void setProductsupplier(Productsupplier productsupplier) {
        this.productsupplier = productsupplier;
    }
 
    public Productfamily getProductfamily() {
        return productfamily;
    }
 
    public void setProductfamily(Productfamily productfamily) {
        this.productfamily = productfamily;
    }
 
    public Deviation getDeviation() {
        return deviation;
    }
 
    public void setDeviation(Deviation deviation) {
        this.deviation = deviation;
    }
 
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.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 Product)) {
            return false;
        }
        Product other = (Product) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }
 
    @Override
    public String toString() {
        return "com.aml.deviations.entity.Product[ id=" + id + " ]";
    }
 
}
Et voici le code concerné du formulaire de création :

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
 
<h:form>
....
<h:dataTable var="product" value="#{deviationView.newDeviation.productList}">
                                <h:column rowHeader="ref produit / product ref">
                                    <h:outputText value="#{product.reference}"/>
                                </h:column>
                                <h:column rowHeader="designation / name">
                                    <h:inputText value="#{product.title}"/>
                                </h:column>
                                <h:column rowHeader="famille / family">
                                    <h:selectOneMenu value="#{product.productfamily}">
                                        <f:selectItems value="#{productfamilyView.productFamilies}" var="family" itemLabel="#{family.title}"/>
                                    </h:selectOneMenu>
                                </h:column>
                            </h:dataTable>
                            <p:commandButton id="prBtn" value="définir / define" type="button" actionListener="#{productView.newProduct}" ajax="true"/>
<p:overlayPanel id="prPanel" for="prBtn" hideEffect="fade" dynamic="true">  
                                <h:form>
                                    <p:inputText value="#{productView.newProduct.reference}"/>
                                    <p:commandButton value="ajouter /add" type="submit" action="#{productView.addProduct}"/>
                                </h:form>
                            </p:overlayPanel>
...
</h:form>
A partir de là je suis perdu dans la conception, je n'arrive pas à lier une liste de produit à une dérogation en cours sans l'intégrer au préalable dans la base.
Pouvez vous m'aider svp ?