Interface ConfirmationTokenRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<ConfirmationToken,,Long> org.springframework.data.jpa.repository.JpaRepository<ConfirmationToken,,Long> org.springframework.data.repository.ListCrudRepository<ConfirmationToken,,Long> org.springframework.data.repository.ListPagingAndSortingRepository<ConfirmationToken,,Long> org.springframework.data.repository.PagingAndSortingRepository<ConfirmationToken,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<ConfirmationToken>,org.springframework.data.repository.Repository<ConfirmationToken,Long>
@Repository
public interface ConfirmationTokenRepository
extends org.springframework.data.jpa.repository.JpaRepository<ConfirmationToken,Long>
Repository interface for entities.
This repository is responsible for data access operations related to
registration and confirmation tokens.
-
Method Summary
Modifier and TypeMethodDescriptionfindByToken(String token) Finds a confirmation token by its unique token string value.intupdateConfirmedAt(String token, LocalDateTime confirmedAt) Updates the confirmedAt timestamp for a token once it has been successfully used to confirm a user's account.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
-
findByToken
Finds a confirmation token by its unique token string value.- Parameters:
token- The unique token string.- Returns:
- A link containing the ConfirmationToken if found, or an empty Optional otherwise.
-
updateConfirmedAt
@Modifying @Query("UPDATE ConfirmationToken c SET c.confirmedAt = ?2 WHERE c.token = ?1") int updateConfirmedAt(String token, LocalDateTime confirmedAt) Updates the confirmedAt timestamp for a token once it has been successfully used to confirm a user's account. This operation requires the Transactional and the Modifying annotations as it performs a data manipulation language (DML) update using a custom JPQL query. (learn more about this on Spring boot we don't know about it really)- Parameters:
token- The token string to identify the record to update.confirmedAt- The LocalDateTime value to set for the confirmed time.- Returns:
- The number of entities updated (should be 1 if done correctly).
-