orm.xml命名查询与输入参数 [英] orm.xml named query with input parameter
问题描述
它发生,所以我需要在我的orm.xml中使用命名查询输入参数在更新声明的集合中。它给我一个参数只能在WHERE或HAVING clausule中使用的错误。
阅读几页后,我发现JPA 2.0不支持它,但是JPA 2.1。
看到这个,bulletpoint 4.6.4
所以我把orm.xml和persistence.xml也改成了2.1的方案,但是它仍然是给出和错误。虽然它仍然运行完美,我讨厌看到错误的迹象。
任何人都有想法?我使用Eclipse Kepler 4.3.2
可以找到orm.xml,persistence.xml,pom.xml和我的项目属性的图片 here
我有同样的问题,代码工作正常,它应该与JPA 2.1(最终版本)
http://download.oracle.com/otn-pub/jcp/persistence-2_1-fr-eval-spec/ JavaPersistence.pdf 在第4.6.4节(第182页)中找到这个文本(我的高亮):
输入参数只能在WHERE子句或查询的HAVING子句或更新语句的SET子句中的更新项目的新值。
但是,eclipse验证仍然在更新查询中输入参数一个错误...
也许我们应该提出一个错误对org.eclipse.persistence.jpa.jpql
I am currently learning JPA with Hibernate, using maven as well.
It happens so that I need to use named query's in my orm.xml with a input parameter in the set-clausule of an update statement. It gives me an error that a parameter can only be used in the WHERE or HAVING clausule.
After reading several pages I found out that JPA 2.0 does not support it, but JPA 2.1 does. See this, bulletpoint 4.6.4
So I changed my orm.xml and persistence.xml to the 2.1 schemes as well, but it still gives and error. Although it still runs perfectly, I hate seeing error signs.
Anyone Any idea? I am using Eclipse Kepler 4.3.2
Pictures of orm.xml, persistence.xml, pom.xml and my project properties can be found here
I have the same problem, code works fine and it should with JPA 2.1 (Final Release)
http://download.oracle.com/otn-pub/jcp/persistence-2_1-fr-eval-spec/JavaPersistence.pdf In chapter4.6.4 (page 182) find this text (my highlight):
"Input parameters can only be used in the WHERE clause or HAVING clause of a query or as the new value for an update item in the SET clause of an update statement. "
But eclipse validation still take input parameter in update query as an error... Maybe we should raise a bug against org.eclipse.persistence.jpa.jpql
这篇关于orm.xml命名查询与输入参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!