Details
-
Type:
New Feature
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.0 M3 (Kay)
-
Component/s: Repositories
-
Labels:
-
Sprint:Ingalls RC1, Ingalls GA, Kay M2, Kay M3
Description
The current naming scheme for methods in CrudRepository cause quite a few problems. Especially the methods taking parameters that are generic type variables. Under bad circumstances they could effectively resolve to the same methods and cause ambiguities.
With the 2.0 release we have the chance to correct those mistakes and the following scheme is suggested (pseudo code):
// Previously ID extends Serializable interface CrudRepository<T, ID> { <S extends T> … save(S entity); // Previously save(Iterable) <S extends T> … saveAll(Iterable<S> entities); // Previously findOne(ID) … findById(ID id); // Previously exists(…) … existsById(ID id); … findAll(); … findAllByIds(Iterable<ID> ids); … count(); // Previously delete(ID) … deleteById(ID id); … delete(T entity); // Previously delete(Iterable) … deleteAll(Iterable<? extends T> entities); … deleteAll(); }
The methods that are effected by a change are marked with a comment here. The new scheme is driven by the following requirements:
- We're able to uniquely find methods by name and raw parameter type (ideally by the number of parameters in the first place). Previously, the generics of esp. the delete(…) methods could effectively resolve to the same type.
- Methods named …All(…) affect a collection of items and/or return one.
- Methods taking an identifier are named …ById(…).
- With that in place, we can reliably drop the ID extends Serializable requirement, which is not possible without that change as then the delete(…) methods would be ambiguous.
Attachments
Issue Links
- is depended on by
-
DATACASS-441 Adapt to API changes in repository interfaces
-
- Resolved
-
-
DATAKV-177 Adapt to API changes in repository interfaces
-
- Resolved
-
-
SGF-623 Adapt to API changes in Repository interfaces
-
- Closed
-
-
DATAMONGO-1679 Adapt to API changes in CrudRepository
-
- Closed
-
-
DATACOUCH-305 Adapt to API changes in repository interfaces
-
- Closed
-
-
DATAGRAPH-991 Adapt to API changes in repository interfaces
-
- Closed
-
-
DATAJPA-1104 Adapt to API changes in repository interfaces
-
- Closed
-
-
DATAKV-176 Adapt to API changes in repository interfaces
-
- Closed
-
-
DATALDAP-35 Adapt to API changes in repository interfaces
-
- Closed
-
-
DATAREDIS-640 Adapt to API changes in repository interfaces
-
- Closed
-
-
DATAREST-1064 Adapt to API changes in repository interfaces
-
- Closed
-
-
DATASOLR-385 Adapt to API changes in repository interfaces
-
- Closed
-
-
DATAES-352 Adapt to API changes in CrudRepository
-
- Closed
-
-
DATAREDIS-641 Adapt to API changes in CrudRepository
-
- Closed
-
-
DATAREST-1065 Adapt to API changes in CrudRepository
-
- Closed
-
-
SGF-622 Adapt to API changes in CrudRepository
-
- Closed
-
- is related to
-
DATACMNS-574 Change CrudRepository to return Optional<T> as return values instead of null reference or provide alternative base interface
-
- Resolved
-