So I'd like to write a sql that will do some counting on a particular table. That table has a repository for it and I'd like to create a method in that repository to handle that.
For example:
Is this possible? I saw something about writing a separate interface and implementation to handle that, but do I need to write any code when I already have the sql in the @Query annotation? I'm assuming I can't do it the way it is above because this EmailHistoryRepository is only returning EmailHist objects.Code:public interface EmailHistoryRepository extends JpaRepository<EmailHistory, Long> { @Query("select email_date, count(1) as sent from email_history group by email_date") public Iterable<SomeCountObject> getHistoryCounts(); }
I did some google-ing but haven't found anything similar to what I'm looking to do so far.


Reply With Quote
