您的位置:首页 > 编程语言 > ASP

spring data jpa 里 Dao层中Repository和JpaSpecificationExecutor的一个小坑

2019-04-16 10:25 519 查看
public interface LabelRepository extends Repository<Label, Long>,JpaSpecificationExecutor<Label> {

List<Label> findAll();

Label save(Label label);

Label update(Label label);
}

项目启动就会报错,因为Repository和JpaSpecificationExecutor中是没有update方法的,项目扫包的时候,发现在Repository和JpaSpecificationExecutor中没有update方法,就认为LabelRepository中的update方法是实体类Label中的一个属性,然后再实体类中又没有找到update属性,就会报错说实体类缺少update属性。

解决方法就是把update给删除掉,更新功能使用save方法就可以实现。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Spring Spring Data JPA
相关文章推荐