Caused by: org.springframework.data.mapping.PropertyReferenceException: No property name found for t
2017-05-24 11:46
1991 查看
刚刚在用spring boot + jpa的时候出现一个问题,就是报错No property name found for type User!。看了一下;后面发现了一个坑,现在记录一下提醒一下
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property name found for type User!
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:64)
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:103)
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:214)
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:77)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:436)
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:221)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:277)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:263)
at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:101)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
... 29 common frames omitted
===解决办法============
原因是在UserRepository中用的方法是:User findByName(String userName);
按照jpa的规范这个就是去找User类的name属性去查询,而我的User的类实体是
所以就找不到了;报错了。
现在就是改成:User findByUserName(String userName);
这样就可以了!
这个解决办法是参考l :http://www.iteye.com/topic/1127339
刚刚入门spring boot+jpa;坑很多;一步步踩;一步步学习了!!描述不对的欢迎指正
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property name found for type User!
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:64)
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:103)
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:214)
at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:77)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:436)
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:221)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:277)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:263)
at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:101)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
... 29 common frames omitted
===解决办法============
原因是在UserRepository中用的方法是:User findByName(String userName);
按照jpa的规范这个就是去找User类的name属性去查询,而我的User的类实体是
所以就找不到了;报错了。
现在就是改成:User findByUserName(String userName);
这样就可以了!
这个解决办法是参考l :http://www.iteye.com/topic/1127339
刚刚入门spring boot+jpa;坑很多;一步步踩;一步步学习了!!描述不对的欢迎指正
相关文章推荐
- org.springframework.data.mapping.PropertyReferenceException: No property created found for type
- org.springframework.data.mapping.PropertyReferenceException: No property xxxx found for type Xxxx
- org.springframework.data.mapping.model.MappingException: No id property found for object of type
- org.springframework.data.mapping.PropertyReferenceException: No property name found for type User
- Caused by: org.springframework.data.mapping.PropertyReferenceException
- Spring Data JPA 报错 :PropertyReferenceException: No property params found for type xxx!
- Caused by: java.lang.ClassNotFoundException: org.springframework.expression.ExpressionParser
- Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException
- org.springframework.data.mapping.PropertyReference
- org.springframework.web.servlet.PageNotFound]-[WARN] No mapping found for HTTP request with URI [/re
- Hibernate错误 Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for pnsame i
- Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of ty
- [org.springframework.web.servlet.PageNotFound] - No mapping found for HTTP request with URI [/ssm/us
- Spring Data JPA: No property name found for type ×××
- org.springframework.web.se rvlet.DispatcherServlet.noHandlerFound No mapping found for HTTP request
- Caused by: java.lang.ClassNotFoundException: org.springframework.expression.ExpressionParser
- Mongodb 在update时 org.springframework.data.mapping.context.InvalidPersistentPropertyPath: No property
- Spring Data JPA - “No Property Found for Type” Exception
- 菜鸟解答:Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException
- [org.springframework.web.servlet.PageNotFound] - No mapping found for HTTP request with URI