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.<init>(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.<init>(Part.java:76)
at org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(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.<init>(PartTree.java:378)
at org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:89)
at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:70)
... 103 common frames omitted
问题原因:
在ProductCategoryRepository中用的方法是:findByCategoryTypeIn(List categoryTypeList)
这里写图片描述
按照jpa默认的规范这个就是去找ProductCategory类中categoryType属性去查询,但是ProductCategory实体类是categorytype:
这里写图片描述
所以找不到categoryType属性,就报了上面的错误。
现在改成 findByCategorytypeIn(List categoryTypeList)
这里写图片描述
这样可以解决问题。

猜你喜欢

转载自blog.csdn.net/damon_01/article/details/80829491