私は次のようなエンティティモデルを持っています:
public class Facture implements Serializable
{
@Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_FACTURE")
private long idFacture;
...
private Panier panier;
...
}
public class Panier
{
@Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_PANIER")
private long idPanier;
@ManyToOne
private Client client;
@OneToMany
private List<LignePanier> articles = new ArrayList<LignePanier>();
...
}
public class Client
{
@Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_CLIENT")
private long idClient;
...
}
したがって、クライアント X からすべてのファクトをクエリしたいと思います。次のようなことを試します。
public List<Facture> listeFacture(Long clientID) {
List<ParameterMap> parameters = new ArrayList<ParameterMap>();
parameters.add(new ParameterMap(StandardBasicTypes.LONG, clientID));
return dao.query("select facture from Facture facture where facture.panier.client.idClient = ?", parameters);
}
私はこの例外を受け取ります:
org.hibernate.QueryException: could not resolve property: client of: be.infoserv.web.model.Facture [select facture from be.infoserv.web.model.Facture facture where facture.panier.client.idClient = ?]
このようなオブジェクトを介してクエリを実行することはできないと思いますが、このクエリの書き方がわかりません...
英語で申し訳ありませんが、私はフランス人のユーザーです。