We are designing a report framework based on Hibernate. Rather than having to create a new entity object and so on each time a user wants a new report to be added to the system, we'd prefer to have this drive as much by data from the back-end database as possible. My thoughts are that the generic handler accepts a set of parameters that determine which report definition to use and what filters to apply to the query when it gets executed.
So imagine a table named report_definition that defines the table, fields, and potentially layout for each field for a given report. This can easily be modeled as a hibernate entity since its a generic table, and a list of these records returned for a specific report (where each record represents a single field).
Now the report service uses this definition above to create a dynamic SQL statement, passes it to the SQLQuery object and retreives the result. I need to take this result and iterate over it and populate a custom detail bean that is more of a collection of records, each record having a NVP between column/value. This way the detail bean can then be passed to the front-end to be displayed using the same JSP.
Has anyone done anything like this in the past? Can you offer any suggestions on approach or technique to solve this?
|