EJB programming & troubleshooting: How do I create jasper report using EJB?

  1. How do I create jasper report using EJB? (5 messages)

    Is there any details about EJB-JASPER reports integration? i am looking for EJB integration or support from JASPER i have done samples with jSP/as well as plan java classes
  2. What do you mean by EJB integration? I could generate the report just by writing this simple code private static void generateReport() { JasperReport jasperReport; JasperPrint jasperPrint; try { jasperReport = JasperCompileManager .compileReport("reports/ShipmentsReport_new.jrxml"); Connection c = getConnection(); jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), c); JasperExportManager.exportReportToPdfFile(jasperPrint, "reports/simple_report.pdf"); JRXlsExporter xlsExporter = new JRXlsExporter(); xlsExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); xlsExporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "reports" + "/" + "classic" + ".xls"); System.out.println("Exporting report..."); xlsExporter.exportReport(); System.out.println("Done!"); close(c); } catch (JRException e) { e.printStackTrace(); } } I think you can as well write the same code in an EJB and generate report.If you want to work with entity beans then I guess there is no support as of now.
  3. Ejb or Jasper doesn't have any special feature for this. But there are diffrent kind of solution for work with ejb. All those are support to work with object list.For this you have to implements JRDataSource best of luck mahee
  4. Use Session Facade[ Go to top ]

    I guess..wat u want is that.. Build a Session Bean which would contain the logic of report generation using Jasper Reports. Now this Session Bean can interact with an Entity Bean to get the data which can be passed to Jasper Report as a datasource. Now the crux here is that it won't be a gud idea to pass an entity bean directly to the Jasper API rather u can create some value objects in between and send them as datasource to Jasper Reports. Thanks, Tarun
  5. I don't know if this is any help but if you download the Windward Reports Java engine, it has a complete EJB example using it's reporting engine in sample 5. Jasper is (a lot) more complicated but the basic approach is the same. thanks - dave
  6. Hi, Loganathan Natarjan. In fact, you can try RAQ Report. It is an user-friendly Java reporting tool.