JPA:NamedQuery of name:<query> not found

Cyr*_*rad 2 entity jpa toplink toplink-essentials

我正在为JPA使用Netbeans 6.9.1和TopLink Essentials.我已经按照JPA连接的必要步骤进行操作.

然而,当我在特定实体中执行命名查询时.这个例外总是回到我身边

NamedQuery of name: [the query name] not found.
Run Code Online (Sandbox Code Playgroud)

这怎么可能,我该如何解决这个问题呢?

Cyr*_*rad 9

我解决了这个问题.我无法确定,但覆盖persistence.xml似乎是一个解决方案

  • @BheshGurung确保命名查询的实体包含在persistence.xml中.如果exclude-unlisted-classes设置为true,这一点尤其重要. (3认同)