title: NonUniqueResultException: JPARepository Spring boot
body: <p>I am using <code>SpringBoot</code> with <code>JPA</code> and <code>QueryDSL</code>. I have written a <code>HQL</code> to fetch some custom records from the table but it is throwing <code>Exception</code>. Below I am mentioning code of repository:</p>
  
  <pre><code>@Repository
  public interface LoanOfferRepository extends JpaRepository&lt;LoanOffer, Long&gt;, QuerydslPredicateExecutor&lt;LoanOffer&gt; {
  
      @Query("select lo.startDate,count(*) from LoanOffer lo where lo.loan.fsp= :fsp and lo.startDate between :fromDate and :toDate Group by lo.startDate")
      public Map&lt;LocalDate,Integer&gt; getLastMonthLoans(@Param("fsp")Fsp fsp,@Param("fromDate")LocalDate fromDate,@Param("toDate")LocalDate toDate);
  }
  </code></pre>
  
  <p>Whenever I call this method <code>getLastMonthLoans()</code> I am getting following exception:</p>
  
  <pre><code>Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.IncorrectResultSizeDataAccessException: query did not return a unique result: 9; nested exception is javax.persistence.NonUniqueResultException: query did not return a unique result: 9] with root cause
  
  javax.persistence.NonUniqueResultException: query did not return a unique result: 9
  </code></pre>
  
  <p>Is there anything wrong with code or Query or Return type ? Query seems to work fine though.</p>