Skip to content

Instantly share code, notes, and snippets.

@jordanbaucke
Created October 31, 2017 18:50
Show Gist options
  • Save jordanbaucke/7b14b3c939774b59063d980feb191016 to your computer and use it in GitHub Desktop.
Save jordanbaucke/7b14b3c939774b59063d980feb191016 to your computer and use it in GitHub Desktop.
/**
* Spring Data JPA repository for the User entity.
*/
public interface UserRepository extends EntityGraphJpaRepository<User, Long> {
Optional<User> findOneByActivationKey(String activationKey);
List<User> findAllByActivatedIsFalseAndCreatedDateBefore(ZonedDateTime dateTime);
Optional<User> findOneByResetKey(String resetKey);
Optional<User> findOneByEmail(String email);
Optional<User> findOneByLogin(String login);
@Query(value = "select distinct user from User user left join fetch user.authorities",
countQuery = "select count(user) from User user")
Page<User> findAllWithAuthorities(Pageable pageable);
@Query("SELECT new com.evasyst.api.web.rest.vm.ManagedUserVM(user) FROM User user")
Page<ManagedUserVM> findAllUsersPaginated(Pageable pageable);
Integer countByOnline(Boolean online);
Optional<User> findOneByUserProfile(UserProfile userProfile);
List<User> findAllByTestData(Boolean testdata);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment