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

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属性。java

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

相关文章
相关标签/搜索