Jump to content

Spring Datasource and Subreports


AndyL

Recommended Posts

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

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

Link to comment
Share on other sites

  • 4 months later...

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&func=view&id=32275&catid=9

 

Your help is very much appreciated. :(

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...