Daniel Haughton
Daniel Haughton

Reputation: 1215

CrudRepository: saveAll - No property saveAll found for type

Trying to create a saveAll method for an Iterable of entites.

Full error is Failed to create query method public abstract java.lang.Iterable com.myCompany.mappingPoc.ConnectionManagerRepo.saveAll(java.lang.Iterable)! No property saveAll found for type ConnectionManager!

@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);
}

Upvotes: 3

Views: 6046

Answers (1)

Jens Schauder
Jens Schauder

Reputation: 81907

As C. Weber writes in his comment

CrudRepository already has a <S extends T> Iterable<S> saveAll(Iterable<S> entities);

You don't need to specify your own.

You seem to expect some kind of query derivation happening here, but that mechanism only works for methods starting with find, exists, count and delete.

Upvotes: 5

Related Questions