Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3245

Jasper plugin does not support supply of data via report parameters (for example Hibernate session object)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.1.6, 2.3.20, 6.1.1
    • 7.0.0
    • Plugin - JasperReports
    • None
    • Present in all environments, attempting usage of Hibernate query HQL embedded in a JasperReport.

    Description

      A typical usage scenario for a Jasper report involves writing code within the report document to retrieve report from a database recent Struts code supports this via supply of a SQL Connection object, but I notice it's not supported in 2.1.6 production release.

      JasperReports supports many implementation languages for it's data retrieval code, but in particular I have identified issue in relation to Hibernate HQL queries.

      Normal route in this scenario (if not using Struts JasperReports plugin) is to supply Hibernate session as a parameter to the report, then implement HQL within the document to retrieve the data. However the Plugin only supports Connection or a pre-populated dataSource as a source for the report's data. This means a temporary data structure (perhaps a sizable List / Map) must be produced in order to present data to the Plugin..

      It would be more efficient and convenient to either support supply of a Hibernate Session object, or allow call to the plugin when both connection and datasource are absent. In this scenario, the plugin would respond by calling

      http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JasperFillManager.html#fillReport(java.io.InputStream,%20java.util.Map)

      And rely on Jasper Fill Manager's inbuilt functionality to draw connection detail from the supplied parameters. This option has the advantage that it can support a range of query languages / connection methods that JasperReports may support, now or in the future.

      The code would of course have to deal with the case in which the relevant report parameters have be left blank, and thus respond with an appropriate error condition, as it does in Struts 2.1.6 when dataSource has been left null.

      I will attempt to produce a patch with proposed modified code in the near future, to assist with this improvement.

      Attachments

        Activity

          People

            Unassigned Unassigned
            awhodgson Andrew Hodgson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: