Implement JPA Projection with count
问题 I want to implement JPA Projection with count. I tried this: @Query(value = "SELECT new org.service.PaymentTransactionsDeclineReasonsDTO( id, count(id) as count, status, error_class, error_message) " + " FROM payment_transactions " + " WHERE terminal_id = :id AND (created_at > :created_at) " + " AND (status != 'approved') " + " GROUP BY error_message " + " ORDER BY count DESC", nativeQuery = true) List<PaymentTransactionsDeclineReasonsDTO> transaction_decline_reasons(@Param("id") Integer