title: How to make dynamic queries at run-time in Spring Boot and Data?
body: <p>I am new to Java and started with Spring Boot and Spring Data JPA, so I know 2 ways on how to fetch data:</p>
  
  <ul>
  <li>by <code>Repository</code> layer, with Literal method naming: FindOneByCity(String city);</li>
  <li>by custom repo, with @Query annotation: @Query('select * from table where city like ?');</li>
  </ul>
  
  <p><em>Both ways are statical designed.</em></p>
  
  <p><strong>How should I do to get data of a query that I have to build at run time?</strong></p>
  
  <p><strong>What I am trying to achieve is</strong> the possibility to create dynamic reports without touching the code. A table would have records of reports with names and SQl queries with default parameters like begin_date, end_date etc, but with a variety of bodies. Example: </p>
  
  <pre><code>"Sales report by payment method" | select * from sales where met_pay = %pay_method% and date is between %begin_date% and %end_date%;
  </code></pre>