Interface UserRepository

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

@Repository public interface UserRepository extends org.springframework.data.jpa.repository.JpaRepository<UserEntity,Long>
Data access for user entities with unique constraints on username and email.
  • Method Summary

    Modifier and Type
    Method
    Description
    Finds a user by username.
    Finds a user by username or email address.

    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

    • findUserByUsernameOrEmail

      Optional<UserEntity> findUserByUsernameOrEmail(String username, String email)
      Finds a user by username or email address.
      Parameters:
      username - username to search for
      email - email address to search for
      Returns:
      optional containing user if found, empty otherwise
    • findByUsername

      Optional<UserEntity> findByUsername(String username)
      Finds a user by username.
      Parameters:
      username - username to search for
      Returns:
      optional containing user if found, empty otherwise