Jump to content

SubReport Hibernate Problem


bcaramu

Recommended Posts

Hi Friends,

I am using Jasper 3.1.2 version with Hibernate 3.2.6 ga, JDK 6.0.

Here I am facing one problem with below:

 

I Have a master report which contained a sub report in <columnFooter> tag .

In master & sub reports I have hql

See attachments

Here master report generating correctly but subreport data is not displying in report

java code:

 

InputStream stream = new ClassPathResource("WebActivityMain.jrxml").getInputStream();
InputStream subReportHourlyStream = new ClassPathResource("WebActivityHourlyReport.jrxml").getInputStream();

HashMap<String, Object> parameters = new HashMap<String, Object>();
JasperDesign subReportHourlyDesign = JRXmlLoader.load(subReportHourlyStream);
JasperReport subReportHourlyReport = JasperCompileManager.compileReport(subReportHourlyDesign);
JasperDesign design = JRXmlLoader.load(stream);
JasperReport report = JasperCompileManager.compileReport(design);
List<WebActivityHourlyResults> subReportHourlyData = dao.getWebActivityHourlyReport(portfolioIds);

    parameters.put("HourlySubreport", subReportHourlyReport);
    parameters.put("subData", subReportHourlyData);
    parameters.put(JRHibernateQueryExecuterFactory.PARAMETER_HIBERNATE_SESSION, dao.getHibSession());
    JasperPrint print    = JasperFillManager.fillReport(report,parameters);


JExcelApiExporter exporter = new JExcelApiExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT,print);
exporter.setParameter(JRXlsExporterParameter.CHARACTER_ENCODING, "UTF-8");
File destFile = new File(exportLocation, reportName + "."+ exportType);
exporter.setParameter(JRExporterParameter.OUTPUT_FILE,destFile);
exporter.setParameter(JRXlsExporterParameter.IS_IGNORE_CELL_BORDER,Boolean.TRUE);
exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);
exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND,Boolean.FALSE);
exporter.setParameter(JRXlsExporterParameter.IGNORE_PAGE_MARGINS,Boolean.TRUE);
exporter.exportReport();

 

Please help me in this code

 



Post Edited by Rama Krishna at 01/20/09 04:16
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,

 

You have attached the same file twice.

First of all, you probably realize that you don't have to compile reports at runtime. You can used pre-compiled report templates (*.jasper files) and this should save you some time.

This FAQ explains:

http://jasperforge.org/uploads/publish/jasperreportswebsite/trunk/faq.html?group_id=252#FAQ22

Secondly, why did you put the subreport in the column footer? The column footer is a fixed size section that does not grow. Consider using some other master report section. Having an 800 pixel tall column footer is very unusual.

I hope this helps.

Teodor

 

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...