title: Rewrite query in JPA
body: <p>I want to rewrite this SQL query in JPA.</p>
  
  <pre><code>String hql = "SELECT date(created_at) AS cdate, sum(amount) AS amount, count(id) AS nooftransaction "
                  + "FROM payment_transactions WHERE date(created_at)&gt;=date(now()- interval 10 DAY) "
                  + "AND date(created_at)&lt;date(now()) GROUP BY date(created_at)";
  
          TypedQuery&lt;Merchants&gt; query = entityManager.createQuery(hql, Merchants.class);
          List&lt;Merchants&gt; merchants = query.getResultList();
  </code></pre>
  
  <p>Is there a way to rewrite the queries into JPA or I should use it as it is?</p>