Caused by: org.springframework.data.mapping.PropertyReferenceException


Caused by: org.springframework.data.mapping.PropertyReferenceException: No property categoryType found for type ProductCategory! Did you mean 'categorytype'?
at org.springframework.data.mapping.PropertyPath.(PropertyPath.java:77)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:329)
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:309)
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:272)
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:243)
at org.springframework.data.repository.query.parser.Part.(Part.java:76)
at org.springframework.data.repository.query.parser.PartTree$OrPart.(PartTree.java:247)
at org.springframework.data.repository.query.parser.PartTree$Predicate.buildTree(PartTree.java:398)
at org.springframework.data.repository.query.parser.PartTree$Predicate.(PartTree.java:378)
at org.springframework.data.repository.query.parser.PartTree.(PartTree.java:89)
at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.(PartTreeJpaQuery.java:70)
... 103 common frames omitted
问题原因:
在ProductCategoryRepository中用的方法是:findByCategoryTypeIn(List categoryTypeList)
这里写图片描述
按照jpa默认的规范这个就是去找ProductCategory类中categoryType属性去查询,但是ProductCategory实体类是categorytype:
这里写图片描述
所以找不到categoryType属性,就报了上面的错误。
现在改成 findByCategorytypeIn(List categoryTypeList)
这里写图片描述
这样可以解决问题。

你可能感兴趣的:(程序语言,数据库,spring,JPA,springdata)