Package energy.eddie.aiida.repositories
Interface AiidaRecordRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<AiidaRecord,,Long> org.springframework.data.jpa.repository.JpaRepository<AiidaRecord,,Long> org.springframework.data.repository.ListCrudRepository<AiidaRecord,,Long> org.springframework.data.repository.ListPagingAndSortingRepository<AiidaRecord,,Long> org.springframework.data.repository.PagingAndSortingRepository<AiidaRecord,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<AiidaRecord>,org.springframework.data.repository.Repository<AiidaRecord,Long>
public interface AiidaRecordRepository
extends org.springframework.data.jpa.repository.JpaRepository<AiidaRecord,Long>
-
Method Summary
Modifier and TypeMethodDescriptionintdeleteOldestByTimestampBefore(Instant threshold, int limit) findByDataSourceIdOrderByTimestampDesc(UUID dataSourceId, org.springframework.data.domain.Pageable pageable) findFirstByDataSourceIdOrderByIdDesc(UUID dataSourceId) Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findFirstByDataSourceIdOrderByIdDesc
-
findByDataSourceIdOrderByTimestampDesc
List<AiidaRecord> findByDataSourceIdOrderByTimestampDesc(UUID dataSourceId, org.springframework.data.domain.Pageable pageable) -
deleteOldestByTimestampBefore
@Transactional @Modifying @Query(value="WITH to_delete AS (\n SELECT id\n FROM aiida_record\n WHERE timestamp < :threshold\n ORDER BY timestamp\n LIMIT :limit\n FOR UPDATE SKIP LOCKED\n)\nDELETE FROM aiida_record\nWHERE id IN (SELECT id FROM to_delete)\n", nativeQuery=true) int deleteOldestByTimestampBefore(@Param("threshold") Instant threshold, @Param("limit") int limit)
-