jorgew.moura Posted February 26, 2018 Share Posted February 26, 2018 I'm studying iReport Design and I started using Connection at my fillReport. Until then, it's ok. The problem is that, now, I'm using Collection, with the commands:List<Sales> sales = new SalesDAO().getSalesByDate( new SimpleDateFormat("yyyyMMdd").parse("20180101"), new SimpleDateFormat("yyyyMMdd").parse("20180131") );JRDataSource dataSource = new JRBeanCollectionDataSource(sales);In those way, when I try execute, it's show me the following error:WARNING: The supplied java.sql.Connection object is null. Link to comment Share on other sites More sharing options...
Friendly User Posted February 28, 2018 Share Posted February 28, 2018 You need either to pass the connection expression or the data source expression to the subreport. Since your subreport is not SQL based and is instead bean based so you'll need to bind the subreport to bean data source using the data source expression. Try something like this:<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{fieldNameToBeUsed})]]></dataSourceExpression>Here is a good stackoverflow post about this:https://stackoverflow.com/questions/11949333/passing-the-list-of-primitive-type-objects-as-datasource-for-subreport 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