Class CrudService<Entity,ID,Dto extends DataTransferObject<Entity>,Pageable extends PaginatedListRequest,Repository extends org.springframework.data.jpa.repository.JpaRepository<Entity,ID> & QuerydslFastPagingRepository<Entity,ID>>

java.lang.Object
biz.devstack.springframework.boot.jpa.crud.CrudService<Entity,ID,Dto,Pageable,Repository>
Type Parameters:
Entity - The entity type managed by this service.
ID - The type of the entity's primary key.
Dto - The DTO type that maps to the entity.
Pageable - The pageable request type for pagination.
Repository - The repository type extending JpaRepository and QuerydslFastPagingRepository.
Direct Known Subclasses:
ExtendedCrudService

public abstract class CrudService<Entity,ID,Dto extends DataTransferObject<Entity>,Pageable extends PaginatedListRequest,Repository extends org.springframework.data.jpa.repository.JpaRepository<Entity,ID> & QuerydslFastPagingRepository<Entity,ID>> extends Object
Generic CRUD service for managing entities with basic operations like Create, Read, Update, Delete, and Pagination.
  • Field Details

  • Constructor Details

    • CrudService

      public CrudService()
  • Method Details

    • fetchEntities

      public org.springframework.data.domain.Page<Entity> fetchEntities(Pageable pageable)
    • createEntityFromDto

      @Transactional public Entity createEntityFromDto(Dto dto)
    • readEntityById

      public Entity readEntityById(ID id)
    • updateEntityFromDto

      @Transactional public Entity updateEntityFromDto(ID id, Dto dto)
    • deleteEntity

      @Transactional public void deleteEntity(ID id)
    • processEntityBeforeCreate

      protected Entity processEntityBeforeCreate(Entity entity, Dto dto)
    • processEntityAfterRead

      protected Entity processEntityAfterRead(Entity entity)
    • processEntityBeforeUpdate

      protected Entity processEntityBeforeUpdate(Entity entity, Dto dto)
    • processEntityBeforeDelete

      protected Entity processEntityBeforeDelete(Entity entity)
    • buildSearchPredicate

      protected com.querydsl.core.types.dsl.BooleanExpression buildSearchPredicate(Pageable pageable)