title: Select fews columns (DTO) with specification JPA
body: <p>I am using spring-data-jpa version 1.5.1.RELEASE . </p>
  
  <p>My domain is : </p>
  
  <pre><code>public class MyDomain{
  ....
  ....
  private String prop1;
  private String prop2;
  ......
  ......
  }
  </code></pre>
  
  <p>My JPA Specification is: </p>
  
  <pre><code>public final class MyDomainSpecs {
  
  public static Specification&lt;MyDomain&gt; search(final String prop1,final String prop2) {
  
      return new Specification&lt;MyDomain&gt;() {
          public Predicate toPredicate(Root&lt;MyDomain&gt; root, CriteriaQuery&lt;?&gt; query, CriteriaBuilder cb) {
              // Some tests if prop1 exist .....
              Predicate predicate1 = cb.equal(root.get("prop1"), prop1);
              Predicate predicate2 = cb.equal(root.get("prop2"), prop2);
              return cb.and(predicate1, predicate2);
          }
  
      };
  }
  </code></pre>
  
  <p>}</p>
  
  <p>My Repository : </p>
  
  <pre><code>public interface MyDomainRepository extends JpaRepository&lt;MyDomain, Long&gt;, JpaSpecificationExecutor&lt;MyDomain&gt; {
  List&lt;MyDomain&gt; findAll(Specification&lt;MyDomain&gt; spec);
  }
  </code></pre>
  
  <p>All is Working . 
  But my need (For performance DB tunning) is to not return and select all fields of MyDomain from DB . </p>
  
  <p>I need to select only for example tree properties (prop1, prop2, prop3) , idealy in a DTO Object . </p>
  
  <p>I don't want to convert My <code>List&lt;MyDomain&gt;</code> to <code>List&lt;MyDto&gt;</code> because i am tunning DB request .  </p>
  
  <p>So , I don't find any way to do that with spring-data-Jpa and Specification . </p>
  
  <p>Any Idea ? </p>
  
  <p>Thanks </p>