Bonjour,
Je souhaite récupérer la liste des comptes créer par un employé mais, j'ai ce message d'erreur au niveau de la condition de ma requête :The state field path 'c.IdEmploye' cannot be resolved to a valid type.
mon fichier queries.xml déja ajouter dans le fichier de persistence.x
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 @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="TypeCompte") public class Compte implements Serializable{ /** * */ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long NumCompte; @Temporal(TemporalType.DATE) private Date DateCreation; @Column(scale = 2) private Double Solde; @ManyToOne @JoinColumn(name="IdClient") private Client client; @OneToMany(mappedBy = "compte") private List<Operation> operations; @ManyToOne @JoinColumn(name="IdEmploye") private Employes employe; //constructeurs et getters et setters }
Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 <?xml version="1.0" encoding="UTF-8"?> <entity-mappings version="1.0" xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"> <named-query name="Compte.CompteCreerEmp"> <query> SELECT c FROM Compte c WHERE c.IdEmploye= :id</query> </named-query> </entity-mappings>
Merci
Partager