JPA踩坑:No property xxx found for type xxx
程序员文章站
2022-07-15 13:12:40
...
问题发现
今天调试一段代码的时候发现有个报错很奇葩。
接口报错:
{
"errorCode": "01",
"errorMessage": "服务器出错",
"returnObject": [
"Parameter value [1531421824] did not match expected type [java.util.Date (n/a)]; nested exception is java.lang.IllegalArgumentException: Parameter value [1531421824] did not match expected type [java.util.Date (n/a)]"
]
}
后台一直报错:
org.springframework.data.mapping.PropertyReferenceException: No property xxxx found for type Xxxx
问题解决
最后发现是同事写[email protected]的时候,@Query里面的东西写错了
//这个是错误的,里面是value不是name=。=尴尬
@Query(name="select * from gene_info where to_days(createtime )= to_days( FROM_UNIXTIME( '?1' ) ) ",nativeQuery=true)
List<GeneInfo> findAll(String createtime);
//正确的是@Query(value=" xxx",nativeQuery=true)
@Query(value="select * from gene_info where to_days(createtime )= to_days( FROM_UNIXTIME( '?1' ) ) ",nativeQuery=true)
List<GeneInfo> findAll(String createtime);
上一篇: configure: error: cannot guess build type; you must specify one
下一篇: 'org.mybatis.spring.mapper.MapperScannerConfigurer' to required type 'xxx' for property 'XX'
推荐阅读
-
org.springframework.data.mapping.PropertyReferenceException: No property xxx found for type xxx
-
使用spring-data-jpa进行count时报错No property count found for type xxx的解决方案
-
No property name found for type XXX解决
-
Spring Data: no property xxx found for type xxxx
-
JPA踩坑:No property xxx found for type xxx
-
JPA Failed to create query for method public abstract;No property xxx found for type xxx问题解决