Package com.example.demo.appuser
Interface UserRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<AppUser,,Long> org.springframework.data.jpa.repository.JpaRepository<AppUser,,Long> org.springframework.data.repository.ListCrudRepository<AppUser,,Long> org.springframework.data.repository.ListPagingAndSortingRepository<AppUser,,Long> org.springframework.data.repository.PagingAndSortingRepository<AppUser,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<AppUser>,org.springframework.data.repository.Repository<AppUser,Long>
@Repository
@Transactional(readOnly=true)
public interface UserRepository
extends org.springframework.data.jpa.repository.JpaRepository<AppUser,Long>
Repository interface for
AppUser entities.
It extends JpaRepository to provide standard database operations
and defines custom methods for specific user lookup and update operations.
-
Method Summary
Modifier and TypeMethodDescriptionintenableAppUser(String email) findByEmail(String email) Finds a user by their unique 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
-
findByEmail
-
enableAppUser
@Transactional @Modifying @Query("UPDATE AppUser a SET a.enabled = TRUE WHERE a.email = ?1") int enableAppUser(String email) Updates theenabledstatus of anAppUsertoTRUEbased on their email.This method is transactional and uses a custom JPQL query to perform the update.
@Modifyingis required to execute a modifying query like UPDATE or DELETE.- Parameters:
email- The email of the user to enable.- Returns:
- The number of entities updated (should be 1 if the user exists).
-