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


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,
from orders ordrs inner join client clnt on ordrs.`client id` =
inner join product prdct on ordrs.`product id` = where = $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

swapnilnagtilak722's picture
Joined: Apr 6 2019 - 7:59am
Last seen: 2 weeks 1 day ago

0 Answers:

No answers yet