Valijon
Valijon

Reputation: 13113

Extend CrudRepository interfaces into base interface

How to extend interfaces CrudRepository<T, ID>, MongoRepository<T, ID>, PagingAndSortingRepository<T, ID> into BaseRepository<T, ID>? (if possible)

I want to have access methods of three interfaces.

I've tried:

@SuppressWarnings("rawtypes")
public interface BaseRepositoryDao<T, ID> extends CrudRepository,
        MongoRepository, PagingAndSortingRepository {

}

How can I achieve that?

EDIT:

MongoRepository already extends PagingAndSortingRepository

Upvotes: 2

Views: 285

Answers (1)

Boris the Spider
Boris the Spider

Reputation: 61198

A MongoRepostory is a CrudRepository and a PagingAndSortingRepository so the following is sufficient:

public interface BaseRepositoryDao<T, ID extends Serializable> extends MongoRepository<T, ID> {

}

Upvotes: 1

Related Questions