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 TypeMethodDescriptionfindByUsername(String username) Finds a user by username.findUserByUsernameOrEmail(String username, String email) 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, 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
-
findUserByUsernameOrEmail
Finds a user by username or email address.- Parameters:
username- username to search foremail- email address to search for- Returns:
- optional containing user if found, empty otherwise
-
findByUsername
Finds a user by username.- Parameters:
username- username to search for- Returns:
- optional containing user if found, empty otherwise
-