[英]The attribute nativeQuery is undefined for the annotation type Query
I'm trying to create a Spring project. 我正在尝试创建一个Spring项目。 In order to create query I used
orm.xml
file: 为了创建查询,我使用了
orm.xml
文件:
<?xml version="1.0" encoding="UTF-8"?> <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd" version="2.0"> <named-query name="Student.getAllStudents"> <query>SELECT s FROM Student s</query> </named-query> </entity-mappings>
This is the interface StudentRepository.java in which this exception apprears: 这是接口StudentRepository.java ,此异常在其中发生:
The attribute nativeQuery is undefined for the annotation type Query
注释类型Query的属性nativeQuery未定义
I'm asking the help to resolve this issue knowing that the version of Spring is 4.0.2. 我正在请求帮助来解决此问题,因为Spring的版本是4.0.2。 Thanks for your help.
谢谢你的帮助。
Thanks to the help of @TG and this thread Setting up spring app with spring data repositories and mongo db , The caused problem is the version of spring data jpa
. 感谢@TG的帮助和该线程使用spring数据存储库和mongo db设置spring应用程序 ,导致的问题是
spring data jpa
的版本。 --> So I move from spring-data-jpa-1.0.0.RELEASE.jar
to spring-data-jpa-1.5.0.RELEASE.jar
.As result, the exception disappears. ->所以我从
spring-data-jpa-1.0.0.RELEASE.jar
移到spring-data-jpa-1.5.0.RELEASE.jar
结果异常消失了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.