forked from dlizarra/spring-boot-react-webpack-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReadOnlyRepository.java
47 lines (39 loc) · 1.16 KB
/
ReadOnlyRepository.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.dlizarra.starter.support.jpa;
import java.io.Serializable;
import java.util.List;
import java.util.Optional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.Repository;
@NoRepositoryBean
public interface ReadOnlyRepository<T, ID extends Serializable> extends Repository<T, ID> {
/**
* Retrieves an entity by its id.
*
* @param id - must not be null.
* @return the entity with the given id or null if none found.
*/
Optional<T> findOne(ID id);
/**
* Returns all instances of the type.
*
* @return
*/
List<T> findAll();
/**
* Returns all instances of the type sorted by the type.
*
* @param sort {@link Sort} object applied to the returned elements list.
* @return sorted list
*/
List<T> findAll(Sort sort);
/**
* Returns a Page of entities meeting the paging restriction provided in the Pageable object.
*
* @param pageable object for pagination information.
* @return A Page of entities.
*/
Page<T> findAll(Pageable pageable);
}