What is the best approach to use JasperReports?

Amr Faisal picture Amr Faisal · Jul 28, 2010 · Viewed 10.7k times · Source

Here we are talking about three main products: JasperReports: which is just a library to generate reports and fill it iReport: which is GUI tool to develop templates used by the above library JasperServer: which is full application with web interface for managing reports with users permissions and other features,

documentation is really not that good, i want to use the best of the above products to integrate JasperReports with my application (Spring/Hibernate), so please advice what is the best approach to do this,

1- design reports using iReport using embedded sql generation, and make it as a separate project from mine, I tried to use Hibernate or Spring within iReport but also I faced a lot of problems and no clear documentation for this part

2- attach it with my project, to use same Hibernate configuration, already created entities

3- try to use JasperServer which seems to be complicated, and then expose reports as webservices

or any other better, guaranteed approach, i know it's dependant on the way my project is dealing, but i've shortage in time, so it depends on the approach having better documentations or tutorials.

Answer

Konrad Garus picture Konrad Garus · Jul 29, 2010

You can write your own Jasper framework in a module or subproject. You can maintain report definitions separately from queries and feed them with data produced by your code.

This way all data and handling stays in your project where it's easier to track or edit (e.g. when you only need to change an aspect of the query, add a filter or rewrite it for better performance). Also, this way you can use report data for something else (e.g. add CSV or XML output).