title: How do we fetch the ResultSet in the desired format when the fields to be fetched are coming as part of the request in spring data jpa?
body: <p>I have an entity with around 20 columns. At any point in time I don't want to fetch all the columns but only the selected columns and I don't know what could those columns be since it's coming from the request as a parameter. What's the right way to achieve this ?</p>
  
  <p>I have tried implementing  this using the native queries but having a hard time parsing the result set to the desired response format.</p>
  
  <pre><code>Query query = entityManager.createNativeQuery("SELECT name, model, desc FROM Product");
  query.getResultList();
  </code></pre>
  
  <p>Now this result set is so generic that I am not able to convert it to the required product model by passing Product.class as a parameter to the query as it fetches only the 3 fields and the rest are missing. And I can't have a predefined projection as it's coming from the API request as a parameter.</p>