Jasper report does not update data

Asked

Viewed 225 times

1

Good night, you guys, I’m having a bit of a frustrating problem. I have an employee report in the system that works fine. Brings the data all correctly. However, when I register a new employee and I file the report again, it does not update, it is showing the previous data. Someone’s been through it?

Below, the excerpt of the code where I make the call:

  public void relProdutoJASPER(List<FuncionarioEntity> p) {
    try {
        InputStream input = getClass().getResourceAsStream("/br/com/portal/jasper/relFuncionario.jasper");
        Map parameters = new HashMap();
        JRBeanCollectionDataSource jb = new JRBeanCollectionDataSource(p);
        JasperPrint jp = JasperFillManager.fillReport(input, parameters, jb);
        JasperViewer js = new JasperViewer(jp, false);
        js.setExtendedState(MAXIMIZED_BOTH);
        js.setTitle("Relatório de Funcionários");
        js.setVisible(true);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
  • Cristiano, checked if in the list of FunctionarioEntity which is passed by parameter is the correct number of employees? Thus ensures that the problem is only in this code snippet.

  • @wakim I checked yes. The amount of the list is always correct, the data too. However, it shows the report always with the old data, the first report generated.

  • 2

    Forget it. I fixed it. The problem wasn’t with the call or anything related to Jasper. The problem was the way I was doing the query in JPA.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.