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

Getting net.sf.jasperreports.engine.JRException: Error retrieving field value from bean:


Recommended Posts

I'm using JRBeanDataSource and that's why child table field is unable to fetch

It can be fetched using query in JasperSoftStudio but programatically it is giving error : net.sf.jasperreports.engine.JRException: Error retrieving field value from bean: fullname.

Query is as following :

select ordrs.voucher, ordrs.advance, ordrs.due, clnt.fullname, prdct.cost, prdct.name

from orders ordrs inner join client clnt on ordrs.`client id` = clnt.id

inner join product prdct on ordrs.`product id` = prdct.id where ordrs.id = $P{id}

But using following program it is cause of an error :

 

        List<Orders> orders = bLManager.searchOrder(Integer.parseInt(textField.getText()));

        Map map = new HashMap();

        map.put("id", Integer.parseInt(textField.getText()));

        try {

            InputStream inputStream = getClass().getResourceAsStream("/com/clientie/reports/Receipt Voucher.jasper");

            JRBeanCollectionDataSource jRBeanCollectionDataSource = new JRBeanCollectionDataSource(orders, false);

            JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream, map, jRBeanCollectionDataSource);

            JasperViewer.viewReport(jasperPrint, false);

        } catch (JRException ex) {

            Logger.getLogger(NewOrderController.class.getName()).log(Level.SEVERE, null, ex);

        }

So when in Order class field name fullname is not exist it's being cause of error.  

Do I need to change my query or I should use JDBC connection insted JRBeanCollectionDataSource?

Using MySQL 8.0.20 JDK 11.0+10 and JasperReport 6.12.2

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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