Interface CrudService<T,U,R,F,ID>
- Type Parameters:
T
- the JPA entity typeU
- the request/upsert/patch DTO typeR
- the full response DTO typeF
- the reference DTO typeID
- the identifier type (e.g. UUID, Long)
- All Known Implementing Classes:
AbstractCrudService
public interface CrudService<T,U,R,F,ID>
Defines the basic CRUD API surface, including pagination, search,
partial updates (patch), upsert, and bulk operations.
-
Method Summary
Modifier and TypeMethodDescriptionlong
count()
Count total number of entities.Create a new entity from the DTO.createAll
(Collection<U> requests) Bulk create from a collection of DTOs.void
Delete an entity by ID.void
deleteAllByIds
(Collection<ID> ids) Bulk delete entities by their IDs.boolean
existsById
(ID id) Check existence by ID.org.springframework.data.domain.Page
<R> Retrieve a page of entities, optionally filtered by a search query.Find by ID or throw ResourceNotFoundException.findByIdOptional
(ID id) Find by ID, returning an Optional.findByIds
(Collection<ID> ids) Retrieve entities by a collection of IDs.findReferenceById
(ID id) Get a reference proxy to the entity (no immediate DB hit).Partially update an existing entity (patch semantics).patchAll
(List<Identified<ID, U>> requests) Bulk patch from a collection of DTOs.org.springframework.data.domain.Page
<R> search
(SearchRequest<T> request, org.springframework.data.domain.Pageable pageable) Execute a typed search using a generated search request object.org.springframework.data.domain.Page
<F> searchRef
(SearchRequest<T> request, org.springframework.data.domain.Pageable pageable) Execute a typed search returning reference DTOs.Update an existing entity by ID from the DTO.updateAll
(List<Identified<ID, U>> requests) Bulk update from a collection of DTOs.Create or update (upsert) based on presence/existence of ID in DTO.upsertAll
(Collection<U> requests) Bulk upsert from a collection of DTOs.
-
Method Details
-
findAll
org.springframework.data.domain.Page<R> findAll(org.springframework.data.domain.Pageable pageable, String searchQuery) Retrieve a page of entities, optionally filtered by a search query. -
search
org.springframework.data.domain.Page<R> search(SearchRequest<T> request, org.springframework.data.domain.Pageable pageable) Execute a typed search using a generated search request object. -
searchRef
org.springframework.data.domain.Page<F> searchRef(SearchRequest<T> request, org.springframework.data.domain.Pageable pageable) Execute a typed search returning reference DTOs. -
findByIds
Retrieve entities by a collection of IDs. -
findByIdOptional
Find by ID, returning an Optional. -
findById
Find by ID or throw ResourceNotFoundException. -
findReferenceById
Get a reference proxy to the entity (no immediate DB hit). -
create
Create a new entity from the DTO. -
update
Update an existing entity by ID from the DTO. -
patch
Partially update an existing entity (patch semantics). -
upsert
Create or update (upsert) based on presence/existence of ID in DTO. -
createAll
Bulk create from a collection of DTOs. -
upsertAll
Bulk upsert from a collection of DTOs. -
updateAll
Bulk update from a collection of DTOs. -
patchAll
Bulk patch from a collection of DTOs. -
delete
Delete an entity by ID. -
deleteAllByIds
Bulk delete entities by their IDs. -
existsById
Check existence by ID. -
count
long count()Count total number of entities.
-