JDBC, Transactions, Spring Data JPA
July 31, 2021
M03 Q29 What is @Query used for?
@Query
annotation can be used on top of Repository method, and with it you can specify query that should be used by JPA. When declaring one on top of finder method, specified query will be used, instead of generating one automatically based on finder method name.
Using @Query
annotation allows you to achieve more control and flexibility of the JPA query that will be executed.