Spring data jpa derived query method -- countby return ArrayList instead of Long

Viewed 67

I am using Spring data with CosmosRepository. I want to count the data present in db which falls under two date. Below is my Repository Interface with derived query methods

public interface UnPublishedOrderRepository extends CosmosRepository<UnPublishedOrder, String> {
    long countAllByOrderFinalizationDateBetween(Date start, Date end);
    long countUnPublishedOrderByOrderFinalizationDateBetween(Date Start, Date end);
    long countByOrderFinalizationDateBetween(Date start, Date end);
}

However when I run the method it gives error java.util.ArrayList cannot be cast to java.lang.Long

It seems all the methods returning ArrayList instead of Long, not sure why. Can anyone help me to know the issue and fix for it.

0 Answers
Related