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 Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.jdbc.core.JdbcTemplateprotected Repository -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected com.querydsl.core.types.dsl.BooleanExpressionbuildSearchPredicate(Pageable pageable) createEntityFromDto(Dto dto) voiddeleteEntity(ID id) org.springframework.data.domain.Page<Entity>fetchEntities(Pageable pageable) protected EntityprocessEntityAfterRead(Entity entity) protected EntityprocessEntityBeforeCreate(Entity entity, Dto dto) protected EntityprocessEntityBeforeDelete(Entity entity) protected EntityprocessEntityBeforeUpdate(Entity entity, Dto dto) readEntityById(ID id) updateEntityFromDto(ID id, Dto dto)
-
Field Details
-
repository
@Autowired protected Repository extends org.springframework.data.jpa.repository.JpaRepository<Entity,ID> & QuerydslFastPagingRepository<Entity, repositoryID> -
jdbcTemplate
@Autowired protected org.springframework.jdbc.core.JdbcTemplate jdbcTemplate
-
-
Constructor Details
-
CrudService
public CrudService()
-
-
Method Details
-
fetchEntities
-
createEntityFromDto
-
readEntityById
-
updateEntityFromDto
-
deleteEntity
-
processEntityBeforeCreate
-
processEntityAfterRead
-
processEntityBeforeUpdate
-
processEntityBeforeDelete
-
buildSearchPredicate
-