Package com.alpaca.repository
Interface GenericRepo<T,ID>
- Type Parameters:
T
- The entity type.ID
- The primary key type of the entity.
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<T,
,ID> org.springframework.data.jpa.repository.JpaRepository<T,
,ID> org.springframework.data.repository.ListCrudRepository<T,
,ID> org.springframework.data.repository.ListPagingAndSortingRepository<T,
,ID> org.springframework.data.repository.PagingAndSortingRepository<T,
,ID> org.springframework.data.repository.query.QueryByExampleExecutor<T>
,org.springframework.data.repository.Repository<T,
ID>
- All Known Subinterfaces:
AdvertiserRepo
,PermissionRepo
,ProfileRepo
,RolePermissionRepo
,RoleRepo
,UserRepo
,UserRoleRepo
@NoRepositoryBean
public interface GenericRepo<T,ID>
extends org.springframework.data.jpa.repository.JpaRepository<T,ID>
Generic repository interface for managing entities.
This interface extends JpaRepository
to provide standard CRUD operations and defines
additional custom queries for entity operations.
The NoRepositoryBean
annotation ensures that Spring does not create an instance of
this interface directly.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionlong
countByIds
(Collection<ID> ids) Counts the number of entities with the given IDs.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save
Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, findAll, findAll, flush, getReferenceById, saveAllAndFlush, saveAndFlush
Methods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAll
Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAll
Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAll
Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
countByIds
@Query("SELECT COUNT(e) FROM #{#entityName} e WHERE e.id IN :ids") long countByIds(@Param("ids") Collection<ID> ids) Counts the number of entities with the given IDs.- Parameters:
ids
- The collection of entity IDs to count - must not be null.- Returns:
- The number of entities found matching the provided IDs.
-