Interface NotificationRepository

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

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

    Modifier and Type
    Method
    Description
    long
     
    findByIdAndRecipientId(Long notificationId, Long recipientId)
     
    findByRecipientIdOrderByCreatedAtDesc(Long recipientId, org.springframework.data.domain.Pageable pageable)
     
    int
    markAllAsRead(Long recipientId)
     

    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

    • findByRecipientIdOrderByCreatedAtDesc

      List<Notification> findByRecipientIdOrderByCreatedAtDesc(Long recipientId, org.springframework.data.domain.Pageable pageable)
    • countByRecipientIdAndReadFalse

      long countByRecipientIdAndReadFalse(Long recipientId)
    • findByIdAndRecipientId

      Optional<Notification> findByIdAndRecipientId(Long notificationId, Long recipientId)
    • markAllAsRead

      @Modifying @Query("update Notification n set n.read = true where n.recipient.id = :recipientId and n.read = false") int markAllAsRead(@Param("recipientId") Long recipientId)