I have a class called Payment that was generated by spring ROO, and I would like to create a "custom" finder ("complex" finder that returns aggregated results) and use Spring ROO's mechanism to generate the jspx files etc. Is this possible?
My code (modified for the question):
How can I generate jspx files for this query? Whenever I try to run "finder add --finderName findPaymentStatistics" I get an error message:Code:package com.mystuff.orm; ... @RooJavaBean @RooToString public class Payment { private Double someValue; ... // My Custom finder!! public static TypedQuery<PaymentSummary> findPaymentStatistics(Calendar fromDate, Calendar toDate) { if (fromDate == null || toDate == null) throw new IllegalArgumentException("Date period argument is required"); EntityManager em = Payment.entityManager(); TypedQuery<PaymentSummary> q = em.createQuery("select new com.mystuff.data.PaymentSummary(sum(o.someValue)) from Payment o where o.startDate >= :startDate and o.endDate <= :endDate", PaymentSummary.class); q.setParameter("startDate", fromDate); q.setParameter("endDate", toDate); return q; } }
Thanks for the help,Dynamic finder is unable to match 'findPaymentStatistics' token of 'findPaymentStatistics' finder definition in Payment.java
Li


Reply With Quote
. However, you can use a known finder name (findBy..DateBetween) which Roo can offer views for and then push it in to customize the SQL statement.
rovided
