title: Group by in Query DSL + Spring Data JPA throwing NoSuchElementException
body: <p>I am trying to execute group by query with Spring Data JPA and Query DSL.</p>
  
  <p>But, I am getting following exception:-</p>
  
  <pre><code>org.springframework.beans.factory.UnsatisfiedDependencyException: 
  Error creating bean with name 'japanWHTDaoImpl': 
     Unsatisfied dependency expressed through field 'wht21940000DataRepo'; 
         nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'japanWHT21940000DataRepository': 
      Invocation of init method failed; nested exception is java.util.NoSuchElementException
  </code></pre>
  
  <p>I tried to write custom repository implementation and giving below my interfaces and impl classes:</p>
  
  <p><strong>Custom interface:</strong></p>
  
  <pre><code>public interface JapanWHT21940000DataRepositoryCustom {
          List&lt;WHT21940000Royalties&gt; findLocalCcyAmtsByRemarks();
  }
  </code></pre>
  
  <p><strong>Custom Impl class:</strong></p>
  
  <pre><code>@Repository
  @Transactional
  public class JapanWHT21940000DataRepositoryCustomImpl extends QueryDslRepositorySupport implements JapanWHT21940000DataRepositoryCustom {
  
      public JapanWHT21940000DataRepositoryCustomImpl(Class&lt;?&gt; domainClass) {
      super(domainClass);
      // TODO Auto-generated constructor stub
      }
  
      @PersistenceContext
      private EntityManager entityManager;
  
      @Override
      public List&lt;WHT21940000Royalties&gt; findLocalCcyAmtsByRemarks() {
      QWHT21940000Data wht21940000Data = QWHT21940000Data.wHT21940000Data;
      JPAQuery&lt;WHT21940000Royalties&gt; query = new JPAQuery&lt;WHT21940000Royalties&gt;(entityManager);
      query.from(wht21940000Data).groupBy(wht21940000Data.remarks).select(wht21940000Data.remarks, wht21940000Data.localCcyAmt.sum());
  
      return null;
      }
  
  }
  </code></pre>
  
  <p><strong>Spring data JPA interface:</strong></p>
  
  <pre><code>public interface JapanWHT21940000DataRepository
      extends JpaRepository&lt;WHT21940000Data, Long&gt;, 
          QueryDslPredicateExecutor&lt;WHT21940000Data&gt;, 
          JapanWHT21940000DataRepositoryCustom {
  
  }
  </code></pre>
  
  <p><strong>and in DAO class:</strong></p>
  
  <pre><code>@Repository
  @Transactional("japanWhtTransactionManager")
  public class JapanWHTDaoImpl implements JapanWHTDao {
      @Autowired
      JapanWHT21940000DataRepository wht21940000DataRepo;
      // more code to follow...
  </code></pre>
  
  <p><strong>EDIT:</strong> Or is there a simpler and better way to do group by query in Spring data JPA + Query DSL than what I am trying?</p>