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

Dan*_*ton 3 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);
}
Run Code Online (Sandbox Code Playgroud)

Jen*_*der 5

正如C. Weber在他的评论中写道

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

您不需要指定您自己的。

您似乎期望此处发生某种查询派生,但该机制仅适用于以findexists和开头count的方法delete