Error creating bean with name ‘XXX‘ Unable to locate Attribute with the the given name
Error creating bean with name ‘XXX’
Failed to create query for method public abstract
Unable to locate Attribute with the the given name
今天在做教师接口的时候,产生这个错误,查了很多资料,都说这个错误的原因是数据库字段名和实体类的属性名不对应,我就去看了自己的数据库,发现并没有不对应,
然后我仔细看报错的提示发现返回的name[tecnum]竟然是小写,然后我就去查了下资料,果然是jpa在读入数据库时会自动转变为小写,而读入的字段名和实体类属性又必须要一模一样且区分大小写,所以就报错了,我把属性改成了小写,成功解决问题。