> >Has anybody done any integration between Cayenne and Jasper? I'm
> >trying to see what my options are for linking the two. At this point,
> >I think just being able to feed a Jasper report from the results of a
> >Cayenne SQLTemplate would be sufficient, though I could see using the
> >query syntax directly in the future...
> >
Just to give some feedback on this... I just completed our initial
implementation of Cayenne-Jasper integration. At this stage, all I did
was use Cayenne as the DataSource. Basically, I have a SQLTemplate
which contains the actual query to be executed. In the report
definition file, I reference the SQLTemplate query name (where you
would normally reference the raw SQL). I use a simple wrapper to pull
the query name from the report file, load it from the DataMap, execute
it, and then place it into a JRDataSource implementation that wraps
the DataRowList (similar to what someone mentioned in this thread
previously). Because SQLTemplate supports parameters, I convert the
JRParameter array into a Map and use it to supply SQLTemplate. This
allows you to actually execute a report using the Jasper applet, etc
to capture the user parameters, but still feed it entirely through
Cayenne
The thing I *really* like about this is that Cayenne can cache the
queries, meaning you can actually have a primitive caching system for
your less-critical reports at the flip of a switch. Plus, using the
Velocity SQLTemplate stuff, as long as the fields you output match
what the Jasper report is expecting, you can leverage Cayenne's much
more flexible (IMO) expression and query building API to filter your
report results. You can even use paging.
My implementation is only 2 small classes. I will post it to the wiki
as soon as I get a chance. Thanks to the people who responded... it
gave me some good thoughts on the integration. If someone is
interested, I think it would be great to integrate this data source
with the iReport designer so that you can develop the reports straight
from the SQLTemplate, rather than moving it into the SQLTemplate after
the fact.
Cris
This archive was generated by hypermail 2.0.0 : Wed Jan 18 2006 - 23:29:48 EST