Jump to content
We've recently updated our Privacy Statement, available here ×

Data-store for Java objects.


shashwat
Go to solution Solved by sanbez,

Recommended Posts

Hi All,

I am new-bie in Jasper and I want to make a report which contains few field and 2 tables. For that I have provided the java beans, for table I am having a list in model and field (collection type) in template report.

And through java code I am trying to generated the report.

But I am getting this execption while filling the table. This is because we are using JRBeanCollectionDataSource while table uses subreport evalution which has the sql connection object.

Please let me know how I should be setting the property for table datastore which can use the java bean.

=================

 

java.lang.ClassCastException: net.sf.jasperreports.engine.data.JRBeanCollectionDataSource cannot be cast to java.sql.Connection
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:369)
at net.sf.jasperreports.components.table.fill.FillTableSubreport.evaluateSubreport(FillTableSubreport.java:95)
at net.sf.jasperreports.components.table.fill.FillTable.evaluate(FillTable.java:106)
at net.sf.jasperreports.engine.fill.JRFillComponentElement.evaluate(JRFillComponentElement.java:88)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:257)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:457)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2037)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:771)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:281)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:144)

 

=================

Thanks

Shashwat

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

  • Solution

Set in main report properties for subreport:
Connection Type = Use a datasource expression
Data Source Expression = (like this:)new JRBeanCollectionDataSource(myCollection)

Check that you don't put DataSourceExpression into "ConnectionType" (see yuor error):
net.sf.jasperreports.engine.data.JRBeanCollectionDataSource cannot be cast to java.sql.Connection



 

Link to comment
Share on other sites

  • 3 weeks later...
  • 4 years later...

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