Interface CrudService<T,U,R,F,ID>

Type Parameters:
T - the JPA entity type
U - the request/upsert/patch DTO type
R - the full response DTO type
F - the reference DTO type
ID - 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 Type
    Method
    Description
    long
    Count total number of entities.
    create(U request)
    Create a new entity from the DTO.
    createAll(Collection<U> requests)
    Bulk create from a collection of DTOs.
    void
    delete(ID id)
    Delete an entity by ID.
    void
    Bulk delete entities by their IDs.
    boolean
    Check existence by ID.
    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.
    Find by ID or throw ResourceNotFoundException.
    Find by ID, returning an Optional.
    Retrieve entities by a collection of IDs.
    Get a reference proxy to the entity (no immediate DB hit).
    patch(ID id, U request)
    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(ID id, U request)
    Update an existing entity by ID from the DTO.
    Bulk update from a collection of DTOs.
    upsert(U request)
    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

      List<R> findByIds(Collection<ID> ids)
      Retrieve entities by a collection of IDs.
    • findByIdOptional

      Optional<R> findByIdOptional(ID id)
      Find by ID, returning an Optional.
    • findById

      R findById(ID id)
      Find by ID or throw ResourceNotFoundException.
    • findReferenceById

      T findReferenceById(ID id)
      Get a reference proxy to the entity (no immediate DB hit).
    • create

      R create(U request)
      Create a new entity from the DTO.
    • update

      R update(ID id, U request)
      Update an existing entity by ID from the DTO.
    • patch

      R patch(ID id, U request)
      Partially update an existing entity (patch semantics).
    • upsert

      R upsert(U request)
      Create or update (upsert) based on presence/existence of ID in DTO.
    • createAll

      List<R> createAll(Collection<U> requests)
      Bulk create from a collection of DTOs.
    • upsertAll

      List<R> upsertAll(Collection<U> requests)
      Bulk upsert from a collection of DTOs.
    • updateAll

      List<R> updateAll(List<Identified<ID,U>> requests)
      Bulk update from a collection of DTOs.
    • patchAll

      List<R> patchAll(List<Identified<ID,U>> requests)
      Bulk patch from a collection of DTOs.
    • delete

      void delete(ID id)
      Delete an entity by ID.
    • deleteAllByIds

      void deleteAllByIds(Collection<ID> ids)
      Bulk delete entities by their IDs.
    • existsById

      boolean existsById(ID id)
      Check existence by ID.
    • count

      long count()
      Count total number of entities.