Bonjour

J'ai une requête en jpa qui me permet de récupérer la liste de tous les dossiers à partir de l'identifiant d'un client (un client peut avoir plusieurs dossiers):

Code java : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 @Query("FROM Dossier a WHERE a.client.idClient = :idClient")
	 List<Dossier> findDossierByIdClient( @Param("idClient") long idClient);

En fonction de l'identifiant du client, j'affiche la liste des dossiers:

Code java : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
model.put("clients", clientService.getAllNomClients());
		 List<Client> listeClients = clientService.getAllNomClients();
		 for (Client d : listeClients) {
			 model.put(d.getNomClient(), dossierService.findDossierByIdClient(d.getIdClient()));
		 }

Donc je mets le nom du client en paramètre, et la liste de ses dossiers comme valeur.

Ensuite dans la liste, j'affiche le résultat:

Code jsp : 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
 <c:forEach items="${clients}" var="client" varStatus="boucle">  
                <h4 class="card-title">Client N° ${boucle.count}: <span id="nomClient">${client.nomClient}</span></h4>  
                   <!-- begin row -->
                        <div class="row ">
                            <div class="col-lg-12">
                                <div class="card card-statistics">
                                    <div class="card-body">
                                        <div class="datatable-wrapper table-responsive">
                                        <c:forEach items="${client.nomClient}" var="dossier" varStatus="boucle"> 
                                            <table id="myTable" class="display compact table table-striped table-bordered ">
                                                <thead>
                                                    <tr>
                                                    	<th>#</th>
                                                    	<th class="bg-light">N° dossier: ${dossier.numDossier} </th>
                                                    	<th>N° Déclaration</th>
                                                        <th>Date entrée</th>
                                                        <th>Nom Article</th>
                                                        <th>Type article</th>
                                                        <th>Quantité entrée</th>
                                                        <th>Quantité Sortie</th>
                                                        <th>Quantité en stock</th>                                                        
                                                    </tr>
                                                </thead>
                                                <tbody>
 
                                                  <tr>
 
                                                  </tr>
 
 
                                                </tbody>                                                
                                            </table>
                                            </c:forEach>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                         </c:forEach>

Je reçois ce message d'erreur:

Caused by: javax.el.PropertyNotFoundException: La propriété [numDossier] n'a pas été trouvée sur le type [java.lang.String]
Pourtant mon modèle est bien en place:

Code java : 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
@Entity
@Table(name = "DOSSIER")
public class Dossier {
 
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "ID_DOSSIER", updatable = false, nullable = false)
	private long idDossier;
 
	@Column(name = "NUM_DOSSIER",  insertable=true, updatable=true, nullable=false)
	private String numDossier;
 
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "client_id", nullable = false)
	private Client client;
 
	@OneToMany(mappedBy="dossier", cascade = CascadeType.ALL)
    private Set<Entree> entrees;
 
 
	public Dossier() {
		super();
	}
 
	public Dossier( String numDossier, boolean isDone) {
		super();
		this.numDossier = numDossier;		
	}
 
	public long getIdDossier() {
		return idDossier;
	}
 
	public void setIdDossier(long idDossier) {
		this.idDossier = idDossier;
	}
 
	public String getNumDossier() {
		return numDossier;
	}
 
	public void setNumDossier(String numDossier) {
		this.numDossier = numDossier;
	}
 
	public Client getClient() {
		return client;
	}
	public void setClient(Client client) {
		this.client = client;
	}
 
	public Set<Entree> getEntrees() {
		return entrees;
	}
	public void setEntrees(Set<Entree> entrees) {
		this.entrees = entrees;
	}
 
}

Merci