Spring Data JPA: No property name found for type ×××
程序员文章站
2022-07-15 13:37:08
...
Spring Data JPA: No property name found for type ×××
转载于https://blog.csdn.net/m0_37893932/article/details/78325927
原因:没有按照JPA的规范去起方法名
实体类
@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就好了
推荐阅读
-
org.springframework.data.mapping.PropertyReferenceException: No property xxx found for type xxx
-
使用spring-data-jpa进行count时报错No property count found for type xxx的解决方案
-
No property name found for type XXX解决
-
Spring Data JPA: No property name found for type ×××
-
Spring Data: no property xxx found for type xxxx
-
JPA踩坑:No property xxx found for type xxx
-
jstl报错ye:javax.el.PropertyNotFoundException: Property 'name' not found on type java.lang.String
-
JPA Failed to create query for method public abstract;No property xxx found for type xxx问题解决