0

I am working with Repository Pattern and I am writing one interface to use the methods CRUD, but i need one custom query, but i don't know how to name the method following a standard.

I am making this way:

public interface Repository<T> {

  void save(T item);

  long saveList(Iterable<T> items);

  List<T> getAll();

  T findById(int id);

  void update(T item);

  void delete(T id);
Enieber
  • 87
  • 6

2 Answers2

0

Give it a name which describes what this query does.

michail_w
  • 4,318
  • 4
  • 26
  • 43
0

I'm not sure to understand what you want to do here.

If you just want to use the CRUD methods and add your custom method to an interface you just have to extends the CrudRepository.

Then you can add your own method either by naming convention or by writing your own query.

Hope it's help...

BenB
  • 146
  • 1
  • 7