Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to register a QueryExecuterFactory in jasper reports in java

Tags:

I implemented JRQueryExecuter and want to use it in a report. Using iReport I managed to register and use the executer.

Now I want to use it in a java application, but I can't find any resources how to register the factory.

I thought it's enough to have the implementation in the classpath, but I get the following exception:

Caused by: net.sf.jasperreports.engine.JRException: No query executer factory class registered for tmql queries.
at net.sf.jasperreports.engine.query.DefaultQueryExecuterFactoryBundle.getQueryExecuterFactory(DefaultQueryExecuterFactoryBundle.java:80)
at net.sf.jasperreports.engine.util.JRQueryExecuterUtils.getQueryExecuterFactory(JRQueryExecuterUtils.java:57)
at net.sf.jasperreports.engine.design.JRDesignDataset.queryLanguageChanged(JRDesignDataset.java:1006)

Can anybody give me a hint?

regards Hannes

like image 307
Hannes Niederhausen Avatar asked Jan 07 '10 15:01

Hannes Niederhausen


People also ask

What is JasperReports in Java?

JasperReports is an open source Java reporting tool that can write to a variety of targets, such as: screen, a printer, into PDF, HTML, Microsoft Excel, RTF, ODT, comma-separated values (CSV) or XML files. JasperReports.

How do I make a two page Jasper report?

To add a new page go to Ireport and "Add Report Group" ,by adding report group you can add as many pages you want. Save this answer.


1 Answers

Using jasperreports 5.2.0, you need to:

  1. Create a custom YourCustomExecuterFactory implementing QueryExecuterFactory class.
  2. Make your new YourCustomExecuterFactory use your custom JRQueryExecuter implementing method QueryExecuterFactory.createQueryExecuter(..)
  3. Map the new language (tmql?) to your custom factory. In your jasperresports.properties set this property: net.sf.jasperreports.query.executer.factory.tmql=your.package.YourCustomExecuterFactory

Hope this helps to somebody.

like image 75
jelies Avatar answered Oct 11 '22 14:10

jelies