Interface FriendshipRepository

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

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

    Modifier and Type
    Method
    Description
     
     
     
     

    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

    • findRelationshipBetween

      @Query("select f\nfrom Friendship f\nwhere (f.requester.id = :userA and f.addressee.id = :userB)\n or (f.requester.id = :userB and f.addressee.id = :userA)\n") Optional<Friendship> findRelationshipBetween(@Param("userA") Long userA, @Param("userB") Long userB)
    • findByAddresseeIdAndStatus

      List<Friendship> findByAddresseeIdAndStatus(Long addresseeId, FriendshipStatus status)
    • findByRequesterIdAndStatus

      List<Friendship> findByRequesterIdAndStatus(Long requesterId, FriendshipStatus status)
    • findAcceptedForUser

      @Query("select f\nfrom Friendship f\nwhere f.status = web.sportflow.friendship.FriendshipStatus.ACCEPTED\n and (f.requester.id = :userId or f.addressee.id = :userId)\n") List<Friendship> findAcceptedForUser(@Param("userId") Long userId)