Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface MongoSearchRepository<T, ID> {
- List<T> searchByPage(String keyword, T example, Pageable page);
- }
- public class MongoSearchRepositoryImpl<T, ID> implements MongoSearchRepository<T, ID> {
- protected MongoOperations mongoOperations;
- @Autowired
- public MongoSearchRepositoryImpl(MongoOperations mongoOperations) {
- this.mongoOperations = mongoOperations;
- }
- @Override
- public List<T> searchByPage(String keyword, T example, Pageable page) {
- Query query = ...;
- return this.mongoOperations.find(
- query,
- this.getEntityInformation().getJavaType(),
- this.getEntityInformation().getCollectionName());
- }
- @Repository
- public interface ProductRepository
- extends MongoCrudRepository<Product, String>,
- MongoSearchRepository<Product, String>
Add Comment
Please, Sign In to add comment