Interface TokenRepository

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

@Repository public interface TokenRepository extends org.springframework.data.jpa.repository.JpaRepository<Token,Long>
This repository provides CRUD operations for the Token entity. It extends JpaRepository and JpaSpecificationExecutor interfaces. JpaRepository provides basic CRUD operations while JpaSpecificationExecutor provides search functionality using specifications.
Author:
Trym Hamer Gudvangen
  • Method Summary

    Modifier and Type
    Method
    Description
    This method retrieves the token object attached to the token value.
    This method retrieves the token attached to the given id.
    This method retrieves the token attached to the given user id.

    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

    • findTokenByTokenId

      Optional<Token> findTokenByTokenId(Long id)
      This method retrieves the token attached to the given id.
      Parameters:
      id - ID of the token, given as a Long object.
      Returns:
      Token object
    • findTokenByToken

      Optional<Token> findTokenByToken(String token)
      This method retrieves the token object attached to the token value.
      Parameters:
      token - Value of the token, given as a String.
      Returns:
      Token object
    • findTokenByUser_userId

      Optional<Token> findTokenByUser_userId(Long userId)
      This method retrieves the token attached to the given user id.
      Parameters:
      userId - ID of the user, given as a Long object.
      Returns:
      Token object