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):
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.