title: Spring data JPA for returning specific fields
body: <p>Does Spring Data have a mechanism for returning specific fields?</p>
  
  <p>I'm familiar with the syntax:</p>
  
  <pre><code>Invoice findByCode(String code);
  </code></pre>
  
  <p>How about this:</p>
  
  <pre><code>Integer findIdByCode(String code);
  </code></pre>
  
  <p>which returns the id field only. Or</p>
  
  <pre><code>Tuple findIdAndNameByCode(String code);
  </code></pre>
  
  <p>which returns a tuple. Or</p>
  
  <pre><code>Invoice findIdAndNameByCode(String code);
  </code></pre>
  
  <p>which returns an entity only populated with specific fields. Can use a constructor taking only those field if defined - else construct empty and populate the fields. </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>To qualify some more, I'm aware of solutions like @Query, constructor expressions and now, @NamedEntityGraph. My question is simply - does Spring data support such a shorthand syntax as I'm suggesting?</p>
  
  <p>If not, perhaps this is a cool enhancement for a later version...</p>
  
  <p>I'm not looking for workarounds.</p>