Java Code Examples for org.springframework.data.jdbc.repository.query.Query

The following examples show how to use org.springframework.data.jdbc.repository.query.Query. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: micronaut-data   Source File: BookRepository.java    License: Apache License 2.0 4 votes vote down vote up
@Query("SELECT * FROM book b WHERE b.title = :title")
Book findByTitle(String title);
 
Example 2
Source Project: library   Source File: PatronsDatabaseRepository.java    License: MIT License 4 votes vote down vote up
@Query("SELECT p.* FROM patron_database_entity p where p.patron_id = :patronId")
PatronDatabaseEntity findByPatronId(@Param("patronId") UUID patronId);
 
Example 3
@Query("SELECT * FROM book WHERE publishing_year = " +
       "(SELECT MAX(publishing_year) FROM book)")
Flux<Book> findTheLatestBooks();
 
Example 4
@Modifying
@Query("UPDATE account SET password = :password WHERE name = :name")	
   void updatePassword(@Param("name") String name, @Param("password") String password);
 
Example 5
@Query("SELECT * FROM book WHERE LENGTH(title) = " +
       "(SELECT MIN(LENGTH(title)) FROM book)")
Stream<Book> findByShortestTitle();
 
Example 6
@Async
@Query("SELECT * FROM book b " +
   "WHERE b.title = :title")
CompletableFuture<Book> findBookByTitleAsync(
   @Param("title") String title);
 
Example 7
@Async
@Query("SELECT * FROM book b " +
   "WHERE b.id > :fromId AND b.id < :toId")
CompletableFuture<Stream<Book>> findBooksByIdBetweenAsync(
   @Param("fromId") Integer from,
   @Param("toId") Integer to);
 
Example 8
@Query("SELECT * FROM message m WHERE m.username = :username")
List<Message> messagesBy(@Param("username") String username);
 
Example 9
@Modifying
@Query("DELETE FROM message WHERE username = :username AND millis = :millis")	
   void deleteMessageBy(@Param("username") String username, @Param("millis") String millis);
 
Example 10
@Query("SELECT * FROM message ORDER BY millis DESC LIMIT :n")
List<Message> newestMessages(@Param("n") int n);
 
Example 11
@RestResource(exported = true)
@Query("SELECT * FROM message m WHERE m.username = :username")
List<Message> messagesBy(@Param("username") String username);
 
Example 12
@RestResource(exported = true)
@Modifying
@Query("DELETE FROM message WHERE username = :username AND millis = :millis")   
void deleteMessageBy(@Param("username") String username, @Param("millis") String millis);
 
Example 13
@RestResource(exported = true)
@Query("SELECT * FROM message ORDER BY millis DESC LIMIT :n")
List<Message> newestMessages(@Param("n") int n);
 
Example 14
@Query("SELECT * FROM message m WHERE m.username = :username")
List<Message> messagesBy(@Param("username") String username);
 
Example 15
@Modifying
@Query("DELETE FROM message WHERE username = :username AND millis = :millis")   
void deleteMessageBy(@Param("username") String username, @Param("millis") String millis);
 
Example 16
@Query("SELECT * FROM message ORDER BY millis DESC LIMIT :n")
List<Message> newestMessages(@Param("n") int n);
 
Example 17
@Query("SELECT * FROM account WHERE name = :name")
Optional<Account> accountByUsername(@Param("name") String name);
 
Example 18
@Query("SELECT * FROM account WHERE email = :email")
Optional<Account> accountByEmail(@Param("email") String email);
 
Example 19
@Modifying
@Query("UPDATE account SET enabled = 1 WHERE name = :name")
   void activateAccount(@Param("name") String name);
 
Example 20
@Modifying
@Query("UPDATE account SET password = :password WHERE name = :name")	
   void updatePassword(@Param("name") String name, @Param("password") String password);
 
Example 21
@Query("SELECT * FROM account WHERE name = $1")
Mono<Account> accountByUsername(String name);
 
Example 22
@Modifying
@Query("DELETE FROM message WHERE username = :username AND millis = :millis")   
void deleteMessageBy(@Param("username") String username, @Param("millis") String millis);
 
Example 23
@Query("SELECT * FROM message ORDER BY millis DESC LIMIT :n")
List<Message> newestMessages(@Param("n") int n);
 
Example 24
@Query("SELECT * FROM account WHERE name = :name")
Optional<Account> accountByUsername(@Param("name") String name);
 
Example 25
@Query("SELECT * FROM account WHERE email = :email")
Optional<Account> accountByEmail(@Param("email") String email);
 
Example 26
@Modifying
@Query("UPDATE account SET enabled = 1 WHERE name = :name")
   void activateAccount(@Param("name") String name);
 
Example 27
@Modifying
@Query("UPDATE account SET password = :password WHERE name = :name")	
   void updatePassword(@Param("name") String name, @Param("password") String password);
 
Example 28
@Query("SELECT * FROM account WHERE email = :email")
Optional<Account> accountByEmail(@Param("email") String email);
 
Example 29
@Query("SELECT * FROM account WHERE email = :email")
Optional<Account> accountByEmail(@Param("email") String email);
 
Example 30
@Modifying
@Query("UPDATE account SET enabled = 1 WHERE name = :name")
   void activateAccount(@Param("name") String name);