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>

public interface UserRepository extends org.springframework.data.jpa.repository.JpaRepository<User,UUID>
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    boolean
     
     
    Loads a user with their roles fetched in the same query.

    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

    • findByUsername

      @EntityGraph(attributePaths="roles") Optional<User> findByUsername(String username)
      Loads a user with their roles fetched in the same query. Roles are LAZY on the entity; authentication is the one path that always needs them, so this finder opts in via an entity graph (a single join, no lazy-init risk).
    • findByEmail

      Optional<User> findByEmail(String email)
    • existsByUsername

      boolean existsByUsername(String username)
    • existsByEmail

      boolean existsByEmail(String email)