Class JpaCrudService<T,K>
java.lang.Object
com.flowingcode.backendcore.service.JpaCrudService<T,K>
- All Implemented Interfaces:
CreationService<T,,K> CrudService<T,,K> DeletionService<T>,QueryService<T,,K> UpdateService<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.data.jpa.domain.Specification<T>buildSpecification(com.flowingcode.backendcore.model.QuerySpec spec) longcount(com.flowingcode.backendcore.model.QuerySpec filter) voidvoiddeleteById(K id) filter(com.flowingcode.backendcore.model.QuerySpec filter) filterWithSingleResult(com.flowingcode.backendcore.model.QuerySpec filter) findAll()protected abstract org.springframework.data.jpa.repository.JpaSpecificationExecutor<T>protected KDefault implementation for obtaining an id from an entity by calling method getId() by reflectionvoid
-
Constructor Details
-
JpaCrudService
public JpaCrudService()
-
-
Method Details
-
getCrudRepository
-
getExecutor
protected abstract org.springframework.data.jpa.repository.JpaSpecificationExecutor<T> getExecutor() -
buildSpecification
protected org.springframework.data.jpa.domain.Specification<T> buildSpecification(com.flowingcode.backendcore.model.QuerySpec spec) -
getId
Default implementation for obtaining an id from an entity by calling method getId() by reflection- Parameters:
entity-- Returns:
-
findById
- Specified by:
findByIdin interfaceQueryService<T,K>
-
findAll
- Specified by:
findAllin interfaceQueryService<T,K>
-
filter
- Specified by:
filterin interfaceQueryService<T,K>
-
filterWithSingleResult
- Specified by:
filterWithSingleResultin interfaceQueryService<T,K>
-
count
public long count(com.flowingcode.backendcore.model.QuerySpec filter) - Specified by:
countin interfaceQueryService<T,K>
-
save
- Specified by:
savein interfaceCreationService<T,K>
-
update
- Specified by:
updatein interfaceUpdateService<T>
-
delete
- Specified by:
deletein interfaceDeletionService<T>
-
deleteById
- Specified by:
deleteByIdin interfaceCrudService<T,K>
-