Demo entry 6024415

Interface

   

Submitted by anonymous on Sep 18, 2016 at 19:05
Language: Java. Code size: 870 Bytes.

public interface SimpleUserRepository extends CrudRepository<User, Long> {

	User findByTheUsersName(String username);
	
	Optional<User> findByUsername(Optional<String> username);
	
	List<User> findByLastname(String lastname);
	
	@Query("select u from User u where u.firstname = :firstname")
	List<User> findByFirstname(String firstname);
	
	@Query("select u from User u where u.firstname = :name or u.lastname = :name")
	List<User> findByFirstnameOrLastname(String name);
	
	Long removeByLastname(String lastname);
	
	Slice<User> findByLastnameOrderByUsernameAsc(String lastname, Pageable page);
	
	List<User> findFirst2ByOrderByLastnameAsc();
	
	List<User> findTop2By(Sort sort);
	
	@Query("select u from User u where u.firstname = :#{#user.firstname} or u.lastname = :#{#user.lastname}")
	Iterable<User> findByFirstnameOrLastname(User user);
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).