Interface InboundRecordRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<InboundRecord,Long>, org.springframework.data.jpa.repository.JpaRepository<InboundRecord,Long>, org.springframework.data.repository.ListCrudRepository<InboundRecord,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<InboundRecord,Long>, org.springframework.data.repository.PagingAndSortingRepository<InboundRecord,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<InboundRecord>, org.springframework.data.repository.Repository<InboundRecord,Long>

public interface InboundRecordRepository extends org.springframework.data.jpa.repository.JpaRepository<InboundRecord,Long>
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    deleteOldestByTimestampBefore(Instant threshold, int limit)
     
     

    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, deleteInBatch, findAll, findAll, flush, getById, getOne, 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

    • findTopByDataSourceIdOrderByTimestampDesc

      Optional<InboundRecord> findTopByDataSourceIdOrderByTimestampDesc(UUID dataSourceId)
    • deleteOldestByTimestampBefore

      @Transactional @Modifying @Query(value="WITH to_delete AS (\n SELECT id\n FROM inbound_record\n WHERE timestamp < :threshold\n ORDER BY timestamp\n LIMIT :limit\n FOR UPDATE SKIP LOCKED\n)\nDELETE FROM inbound_record\nWHERE id IN (SELECT id FROM to_delete)\n", nativeQuery=true) int deleteOldestByTimestampBefore(@Param("threshold") Instant threshold, @Param("limit") int limit)