【问题标题】:CrudRepository: saveAll - No property saveAll found for typeCrudRepository:saveAll - 找不到类型的属性 saveAll
【发布时间】:2019-10-20 21:24:24
【问题描述】:

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

完全错误是无法创建查询方法 public abstract 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);
}

【问题讨论】:

  • CrudRepository 已经有一个 Iterable saveAll(Iterable entities);

标签: hibernate spring-data-jpa


【解决方案1】:

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

CrudRepository 已经有一个&lt;S extends T&gt; Iterable&lt;S&gt; saveAll(Iterable&lt;S&gt; entities);

您无需指定自己的。

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

【讨论】:

    猜你喜欢
    • 2017-12-16
    • 2018-09-24
    • 2022-01-18
    • 2021-08-14
    • 2021-12-26
    • 2020-08-30
    • 1970-01-01
    • 2019-02-20
    相关资源
    最近更新 更多