5

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

3 Answers 3

3

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.

1

The documentation suggests to set a property:

JasperReport jasperReport = <...>
jasperReport.setProperty(JRQueryExecuterFactory.QUERY_EXECUTER_FACTORY_PREFIX + "<query language>", "<value>");

Does that work?

1

Set the property before calling JasperCompileManager.

Example below using plsql query language:

JRProperties.setProperty(QueryExecuterFactory.QUERY_EXECUTER_FACTORY_PREFIX+"plsql"
                            ,"com.jaspersoft.jrx.query.PlSqlQueryExecuterFactory");
JasperReport jasperReport =
            JasperCompileManager.compileReport(sourceFile);
2
  • JRProperties is deprecated in Jasper Reports v6.1.0 and above - Is there any example how to do the same with jasperreports v6.8.0 ?
    – 09Q71AO534
    Commented Apr 18, 2019 at 10:01
  • using JRPropertiesUtil how can we set the plsql query ?
    – 09Q71AO534
    Commented Apr 18, 2019 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.