SpringData_CrudRepository接口

CrudRepository

  • CrudRepository 接口提供了最基本的对实体类的添删改查操作 

  • T save(T entity);//保存单个实体 

  • Iterable<T> save(Iterable<? extends T> entities);//保存集合       

  • T findOne(ID id);//根据id查找实体        

  • boolean exists(ID id);//根据id判断实体是否存在        

  • Iterable<T> findAll();//查询所有实体,不用或慎用!        

  • long count();//查询实体数量        

  • void delete(ID id);//根据Id删除实体        

  • void delete(T entity);//删除一个实体 

  • void delete(Iterable<? extends T> entities);//删除一个实体的集合        

  • void deleteAll();//删除所有实体,不用或慎用! 

原文地址:https://www.cnblogs.com/airycode/p/6536503.html