I have a simple question: why JpaRepository is returning List of entities but CrudRepository returns Iterable of entities?
Is it done on purpose? I guess it's because CrudRepository is more generic interface and there may be some specific repository which returns Iterable.
It makes harder to use CrudRepository without using specific JpaRepository..
Thanks
The class CrudRepository
is part of the Spring Data Commons project and is the recommended interface to extend regardless of the actual data store used.
The reason CrudRepository
methods return Iterable
and not List
(or Set
) is because some data stores allow streaming of results and using a Collection
type would result in loss of functionality for such stores.