【发布时间】:2015-09-24 21:11:52
【问题描述】:
我尝试在我的 Java EE 应用程序中编写此查询:
public List<Fornitore> findByMaxOrdine(int maxordine)
{
Query query;
query = em.createQuery("SELECT b FROM Fornitore b WHERE b.maxOrdini > maxordine");
query.setParameter("maxordine", maxordine);
return query.getResultList();
}
当我尝试运行它时,结果如下:
Exception Description: Problem compiling [SELECT b FROM Fornitore b WHERE b.maxOrdini > maxordine][46, 55] The identification variable 'maxordine' cannot be used in conjunction with the > operator.[46, 55] The identification variable 'maxordine' is not defined in the FROM clause.
我不明白为什么它不起作用。 感谢您的帮助。
【问题讨论】:
-
你试过
SELECT b FROM Fornitore b WHERE b.maxOrdini > :maxordine吗?