Spring Data JPA: No property name found for type ×××
2017-10-24 09:29
2211 查看
原因:没有按照JPA的规范去起方法名
可以看出实体类字段是userName,而repository却是findByName!改为findByUserName就好了
还可能是http://blog.csdn.net/usedtolove/article/details/40349207 这篇文章提到的原因
实体类
@Entity public class User{ @Id @GeneratedValue private Long id; private String userName; }
repository
public interface UserRepository extends JpaRepository<User, Long>{ User findByName(String userName); }
可以看出实体类字段是userName,而repository却是findByName!改为findByUserName就好了
还可能是http://blog.csdn.net/usedtolove/article/details/40349207 这篇文章提到的原因
相关文章推荐
- Spring Data JPA: No property foo found for type Bar
- Spring Data JPA - “No Property Found for Type” Exception
- Spring Data JPA 报错 :PropertyReferenceException: No property params found for type xxx!
- org.springframework.data.mapping.PropertyReferenceException: No property xxxx found for type Xxxx
- Spring Data Jpa 异常:PropertyReferenceException: No property xx for type yy
- Caused by: org.springframework.data.mapping.PropertyReferenceException: No property name found for t
- Spring Data JPA 全局DAO的扩展(第一次用JPA时总是提示 另人抓狂的错误: No property find for type class )
- org.springframework.data.mapping.model.MappingException: No id property found for object of type
- org.springframework.data.mapping.PropertyReferenceException: No property created found for type
- spring3+struts2+hibernate3整合出现的问题,No mapping found for dependency [type=java.lang.String, name='str
- No mapping found for dependency [type=java.lang.String, name='struts.objectFactory.spring.autoWire.
- spring-data-elasticsearch查询No property ... found for...Did you mean '...'?
- jpa中PropertyReferenceException: No property found for type异常原因
- Spring : No mapping found for HTTP request with URI in DispatcherServlet with name "..."
- mybatis出现No typehandler found for property xxx
- No property toPredicate found for type User!报错
- spring data jpa javax.el.PropertyNotFoundException
- No mapping found for HTTP request with URI [/spring/WEB-INF/page/index.jsp] in DispatcherServlet with name &#39;spring&#39;
- springboot访问方法时出错:Spring Boot Application: No converter found for return value of type
- no typehandler found for property XXXX