How to write dynamic native SQL Query in spring data JPA?
问题 I need to write a search query on multiple tables in database in spring boot web application. It uses spring data jpa. I know we can write native query in spring data jpa using @Query annotation and native = true flag. Is there any way I can write query in repository class and instead of the @Query annotation as the Query is very complex and dynamic. 回答1: You need to do a CustomRepository and add a method with native query. I do that this way: Create your custom repository: public interface