Caused by: org.springframework.data.mapping.PropertyReferenceException: No property type found for t

Caused by: org.springframework.data.mapping.PropertyReferenceException: No property type found for type SysDictionary! Did you mean 'dType','DType'?
    at org.springframework.data.mapping.PropertyPath.(PropertyPath.java:92)
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:356)
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:332)
    at org.springframework.data.mapping.PropertyPath.lambda$from$0(PropertyPath.java:285)
 

记录下做项目遇到的错误,用的是SpringBoot+jpa。经过检查,发现dao层接口方法写错了参数,这是jpa的规范,不大熟悉的人估计都要经历一波。

解决:

查看实体类发现参数是dType

Caused by: org.springframework.data.mapping.PropertyReferenceException: No property type found for t_第1张图片

而Repository中我写成了 :findDistinctByType(String dType),By后面的type少了个d

Caused by: org.springframework.data.mapping.PropertyReferenceException: No property type found for t_第2张图片

改成: SysDictionary findDistinctByDType(String dType);

总结:总得来说就是jpa的规范限制的,需要做的就是方法名By的参数根据实体类中的来就不会报此错。

 

你可能感兴趣的:(java,jpa)