Interface UserRepo

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

@Transactional(readOnly=true) @Repository public interface UserRepo extends org.springframework.data.jpa.repository.JpaRepository<User,Long>
Repository interface to access from data and model, also create entity for user
Author:
Loc Bui Nhien
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Enable this user to login.
     
    Find this user by email.
     
    Find this user by username.

    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, findAll, findAll, findAllById, flush, getById, getOne, saveAll, saveAllAndFlush, saveAndFlush

    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

    • findByEmail

      Optional<User> findByEmail(String email)
    • findByUsername

      Optional<User> findByUsername(String username)
    • enableAppUser

      @Transactional @Modifying @Query("UPDATE User a SET a.enabled = TRUE WHERE a.email = ?1") int enableAppUser(String email)
      Enable this user to login.
      Parameters:
      email -
      Returns:
    • FindByEmail

      @Query("SELECT c FROM User c WHERE c.email = ?1") User FindByEmail(String email)
      Find this user by email.
      Parameters:
      email -
      Returns:
      user object found using email
    • FindByUsername

      @Query("SELECT c FROM User c WHERE c.username = ?1") User FindByUsername(String username)
      Find this user by username.
      Parameters:
      username -
      Returns:
      user object found using username