简体   繁体   English

注释类型Query的属性nativeQuery未定义

[英]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.

相关问题 Spring Data JPA @Query注释,nativeQuery = true, - Spring Data JPA @Query annotation, nativeQuery = true, 对于注释类型Transactional,未定义属性readOnly - The attribute readOnly is undefined for the annotation type Transactional 注释类型 SerializedName 的属性“alternate”未定义 - The attribute “alternate” is undefined for the annotation type SerializedName JAXB:注释类型XmlElement的属性名称未定义 - JAXB: The attribute name is undefined for the annotation type XmlElement 注释类型测试的预期属性未定义 - the attribute expected is undefined for the annotation type test 从@Query批注中获取具有nativeQuery true J​​PARepository的两列 - Get two columns from @Query annotation having nativeQuery true JPARepository 为“MediaType.APPLICATION_JSON”生成的注释类型的属性值未定义 - The attribute value is undefined for the annotation type Produces for “MediaType.APPLICATION_JSON” 使用注释处理器向类型添加属性 - Adding an attribute to a type with an annotation processor 跨浏览器测试脚本显示“注释类型参数的属性值未定义”错误 - “The attribute value is undefined for the annotation type Parameters” error is displayed for Cross-Browser Testing Script hibernate 5.4.12.Final“未定义注释类型NamedQuery的可缓存属性”,是否不支持cacheable = true? - hibernate 5.4.12.Final "The attribute cacheable is undefined for the annotation type NamedQuery", is cacheable = true not supported?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM