Eclipse Indigo - JPA验证问题 [英] Eclipse Indigo - JPA Validation Problems
问题描述
我正在使用eclipse indigo并且遇到JPA验证问题。
I'm using eclipse indigo and am having "JPA Validation Problems".
我的命名查询是:
from Person p where p.name = :name
并且出现此错误:
The query does not start with a valid identifier, has to be either SELECT, UPDATE or DELETE FROM.
但它是一个有效的JPQL查询。有人知道如何删除此错误吗?
But it's a valid JPQL query. Somebody know how I can remove this error?
如果我将查询更改为
select p from Person p where p.name = :name
没有更多错误,但我不想改变我的所有疑问。
there is no more error, but I do not want to change all my queries.
谢谢
mp5
推荐答案
它看起来像任何形式的查询:
It looks to me like any queries that are of the form:
from Person p where p.name = :name
实际上并非有效JPQL。根据以下语言参考:
Are not in fact valid JPQL. According to the language reference at:
http://docs.oracle.com/javaee/5/tutorial/doc/bnbuf.html
每个声明需要有 SELECT
, UPDATE
或 DELETE
语句 FROM
部分。
each statement needs to have either a SELECT
, UPDATE
or DELETE
statement preceding the FROM
portion.
以下是更多示例:
http://en.wikipedia.org/wiki/Java_Persistence_Query_Language
不幸的是,您似乎需要更新所有查询以使其符合此格式。
Unfortunately, it looks like you need to update all the queries to make them fit this format.
这篇关于Eclipse Indigo - JPA验证问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!