Spring Datasource and Subreports

Hi

I have two reports - one master report and one sub report.

I have set up a Spring Loaded Hibernate connection as the datsource - this appears to be fine.

If i run the reports seperately they are fine. However, when I run the master report the subreport fails to appear.

Having searched the forums this appears to be a common problem and it would seem that no-one has posted an answer.

How exactly do i pass the data source between the master and the sub-report ? I have noticed brief references to using the datasource expression but no examples of what exacly should be entered in this expression.

If i set up the scenario using a JDBC connection and pass the $P{REPORT_CONNECTION} parameter all works as expected.

If i set up the scenario using a Spring Loaded Hibernate connection and pass the $P{REPORT_DATA_SOURCE} parameter the sub-report does not display.

What exactly do I pass to the sub report and eaxctly how do i pass it.

I am using iReport 1.3.2

Cheers

Andy
AndyL's picture
42
Joined: Jun 10 2007 - 7:17pm
Last seen: 16 years 3 months ago

2 Answers:

OK I have managed to solve this one.

The solution is as follows.

In Subreport Properties > Subreport tab, set the Connection/Datasource Expression to Don't use connection or Data Source.



In Subreport Properties > Subreport (Other ) tab > Subreport Parameters tab - add a parameter called HIBERNATE_SESSION and set it's corresponding Expression to $P{HIBERNATE_SESSION}.

By doing this, the Hibernate Session from the master ( which is a built-in parameter ) is passed through as a parameter to the subreport and assigned to the subreports own version of this parameter.

Hey presto - it all works.

HTH

Andy
AndyL's picture
42
Joined: Jun 10 2007 - 7:17pm
Last seen: 16 years 3 months ago
Hi andy,

It's great to know that you have successfully made the connection for Spring Hibernate Connection datasource. Could you help me to go through a bit on how do you do that ? I bought the iReport manual but it doesn't seems to be helpful.

I had posted a question at here http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&f...

Your help is very much appreciated. :(
yientau's picture
41
Joined: Oct 2 2007 - 1:40pm
Last seen: 7 years 6 months ago
Feedback