I want to execute following Query using JPA repository implementation.
Query:select sum(amount) from transactions where transaction_date_time between '2017-05-04 00:01:07' and '2017-05-04 23:03:07' and id=2;
For finding I am using something like:
public interface TransactionRepository extends JpaRepository<Transaction, Serializable>{
Transaction findById(Long id);
}
So for sum I need something like this:
Double sumAmountByTransactionDateTimeBetweenAndMerchantId(Date from, Date to, Long merchantId);
I don't want to use @Query. I just want to create method name which will do my job. So, this is not a duplicate. I tried with above function name but it is not doing my job.