anujgu Posted October 12, 2006 Share Posted October 12, 2006 Hi, I am getting Error while integrating Jasper reports with Hibernate... I have the following code.. List list = s.getReportsData ("shantanu9@xyz.com","AnujTest","Subscription",stamp,estamp); JasperReport jasperReport;JasperPrint jasperPrint; Map parameters = new HashMap(); JasperDesign jasperDesign = JRXmlLoader.load("C:/eclipse/workspace/anuj/com/test/jasperreports_demo.jrxml"); jasperReport = JasperManager.compileReport(jasperDesign); JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(list); jasperPrint = JasperManager.fillReport(jasperReport, parameters, ds); JasperManager.printReportToPdfFile(jasperPrint, "C:/eclipse/workspace/anuj/com/test/Report.pdf"); The list which my Business Layer is returning consists of a Transaction table rows in which each coulmn represents Other class for eg one column represents SaasUserImpl.class. After I pass the list to Jasper reprt's xml file i get Class Cast exception that class cast exception SaasUserImpl.. n if I type cast it into my known class by using object it says invalid report format... <reportElement mode="Opaque" backcolor= "#ffdd99" positionType="Float" x="132" y="12" width="80" height="20"/> <textElement textAlignment="Center"/> <textFieldExpression class="java.lang.String"><![CDATA[$F{userId}_getLoginName()]]></textFieldExpression> </textField> Kindly let me know is there any way i can retrieve my class objects in the xml file.... regards, Anuj ... Link to comment Share on other sites More sharing options...
wegnerk Posted October 12, 2006 Share Posted October 12, 2006 I think you have to set a specific parameter in your parameter map: Code:map.add(JRHibernateQueryExecuterFactory.PARAMETER_HIBERNATE_SESSION, session); so that jasperreports know that you use Hibernate... hope this hint helps. Link to comment Share on other sites More sharing options...
teodord Posted October 16, 2006 Share Posted October 16, 2006 Hi, A complete stack trace would help.And you do not need what Katya said as you do not put Hibernate queries inside JRXML. Thank you,Teodor Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now