CrudRepository:saveAll-未找到类型的属性saveAll

时间:2019-06-05 11:06:24

标签: hibernate spring-data-jpa

尝试为实体的Iterable创建saveAll方法。

完全错误未能创建查询方法公共抽象java.lang.Iterable com.myCompany.mappingPoc.ConnectionManagerRepo.saveAll(java.lang.Iterable)!找不到ConnectionManager类型的属性saveAll!

@Repository
public interface ConnectionManagerRepo extends CrudRepository<ConnectionManager, Long> {

Iterable<ConnectionManager> findAllByControlId(Long controlId);

Page<ConnectionManager> findAllByControlId(Pageable p, Long controlId);

Iterable<ConnectionManager> saveAll(Iterable<ConnectionManager> connectionManagers);
}

1 个答案:

答案 0 :(得分:0)

作为 C。韦伯在评论中写道

  

CrudRepository已经有一个<S extends T> Iterable<S> saveAll(Iterable<S> entities);

您不需要指定自己的。

您似乎希望这里发生某种查询派生,但是该机制仅适用于以findexistscountdelete开头的方法。