Package app.YUP.repository
Interface UserRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<User,,UUID> org.springframework.data.jpa.repository.JpaRepository<User,,UUID> org.springframework.data.repository.ListCrudRepository<User,,UUID> org.springframework.data.repository.ListPagingAndSortingRepository<User,,UUID> org.springframework.data.repository.PagingAndSortingRepository<User,,UUID> org.springframework.data.repository.query.QueryByExampleExecutor<User>,org.springframework.data.repository.Repository<User,UUID>
@Repository
public interface UserRepository
extends org.springframework.data.jpa.repository.JpaRepository<User,UUID>
Repository interface for the User entity.
This interface extends JpaRepository and provides methods to perform CRUD operations on the User entity.
It is annotated with @Repository to indicate that it is a Spring Data repository.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanexistsByEmail(String email) Checks if a user exists by their email.booleanexistsByUsername(String username) Checks if a user exists by their username.Finds a user by their ID.findByUsername(String username) Finds a user by their username.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, 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
-
findByUsername
Finds a user by their username.- Parameters:
username- the username of the user- Returns:
- an Optional containing the user if found, or an empty Optional if not found
-
findById
Finds a user by their ID. -
existsByUsername
Checks if a user exists by their username.- Parameters:
username- the username of the user- Returns:
- true if a user with the given username exists, false otherwise
-
existsByEmail
Checks if a user exists by their email.- Parameters:
email- the email of the user- Returns:
- true if a user with the given email exists, false otherwise
-