Interface UserRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<AppUser,​Location>, org.springframework.data.jpa.repository.JpaRepository<AppUser,​Location>, org.springframework.data.repository.PagingAndSortingRepository<AppUser,​Location>, org.springframework.data.repository.query.QueryByExampleExecutor<AppUser>, org.springframework.data.repository.Repository<AppUser,​Location>

public interface UserRepository
extends org.springframework.data.jpa.repository.JpaRepository<AppUser,​Location>

User Repository

Interface that manages the queries executed by the program to get information from the database about the user table.

  • Method Summary

    Modifier and Type Method Description
    java.util.Optional<AppUser> findById​(java.lang.Long id)  
    java.util.Optional<AppUser> findByUsername​(java.lang.String email)
    FIND BY EMAIL
    java.util.Optional<AppUser> findByUsernameAndPassword​(java.lang.String email, java.lang.String password)
    FIND BY EMAIL AND PASSWORD

    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, findAll, findAll, findAllById, flush, getById, getOne, saveAll, saveAllAndFlush, saveAndFlush

    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

    • findById

      java.util.Optional<AppUser> findById​(java.lang.Long id)
    • findByUsername

      java.util.Optional<AppUser> findByUsername​(java.lang.String email)

      FIND BY EMAIL

      Search a user in the database using it's email. All emails in the database are unique, so it will only get a maximum of one user.

      Parameters:
      email - The email of the user that is going to be searched.
      Returns:
      Optional value, if the user email was found will return the user.
    • findByUsernameAndPassword

      java.util.Optional<AppUser> findByUsernameAndPassword​(java.lang.String email, java.lang.String password)

      FIND BY EMAIL AND PASSWORD

      Search a user in the database using it's email and password. All emails in the database are unique, so it will only get a maximum of one user.

      Parameters:
      email - The email of the user that is going to be searched.
      password - The password of the user account referenced by the email.
      Returns:
      Optional value, if the user email was found will return the user.