Infinite loop when generating report?

  • paco valsera

    paco valsera - 2014-03-20

    I'm not sure if this is a bug or something is wrong in my code. This is what I'm trying to do:

    Main Entity

    @View(members="input {input} output {output}")
    @ManyToOne(fetch=FetchType.LAZY, cascade=CascadeType.REMOVE)
    private Output output;

    Output Entity

    @View(name="reference", members="flows {flows} report {report}")
    @OneToMany(mappedBy="output", fetch=FetchType.LAZY, cascade=CascadeType.REMOVE)
    @OrderBy("year asc")
    private Collection<Flow> flows;
    private String report;

    Flow Entity

    private int year;
    private BigDecimal amount;
    private Output output;

    From the Main Entity view, the "flows" collections shows the standard "generate report PDF/Excel" actions, but when I try to launch any of them, OX seems to get stuck in an infinite loop. Debugging the code I have found that the getcollection() method in TabBaseAction remains in a while loop forever. This is the stack:


    Any clue about it? Thanks.

    PS: I forgot to mention that I'm working with OX v4.9.1.

    Last edit: paco valsera 2014-03-20
  • Javier Paniza

    Javier Paniza - 2014-03-24

    Hi Paco,

    does it work if you remove the @AsEmbedded annotation from collection?
    Does the other actions of the collection work fine?
    Any stacktrace?

    Please, put here a simplified but complete version of your code, so I can copy and paste in my workspace and reproduce it.

    Ayuda a otros en este foro como yo te ayudo a ti.

  • paco valsera

    paco valsera - 2014-03-25

    Thanks for your answer Javier. I attach an OX project (v4.9.1) with the test case, I hope this helps.

    By the way I have tried to remove the @AsEmbedded annotation with no success.

  • Javier Paniza

    Javier Paniza - 2014-03-27

    Hi Paco,

    I tried your code. First I copy and paster your 3 entities in own my projects using the latest SVN code for OX, and it worked fine. So, I install your project "as is" in a OpenXava 4.9.1 distribution. I only changed H2 by Hypersonic for convenience. Again, it worked fine.

    My test was creating a new Output adding two Flows, afterward I go to list mode, select the created Output and in detail mode I click in Generate PDF for the flows collections. The report is generated with no issue.

    Maybe I'm not doing the test well. Which exact steps I have to follow to reproduce the problem?

    Help others in this forum as I help you.

  • paco valsera

    paco valsera - 2014-03-27

    Sorry Javier, I should have explained better the way to test the case. The Output itself is not the problem.

    I added a TestModule in application.xml to help with testing. So you should point your browser to http://localhost:8080/OXTesting/modules/TestModule.

    Firstly you have to create a new entity, save it and go to the list mode. Then, edit the saved entity and you will be able to run the "compute output" to get a bunch of random flows (the reference is annotated as no create/modify/search, so this will help to initialized the collection). All these steps are because this action is not fail safe, so it needs an already saved entity.

    After that, if you launch the generate pdf/xls action you should reach the infinite loop. I think it is related to the double section defined in the view of Module, as you can see in the attached screenshot.

    Thanks again for you help. Regards.

  • Javier Paniza

    Javier Paniza - 2014-03-31

    Hi Paco,

    OK, I achieved to reproduce your case. Definitely it's a bug. Please add it and we'll solve it for future OX version.

    Ayuda a otros en este foro como yo te ayudo a ti.

  • paco valsera

    paco valsera - 2014-04-01

    Thanks for your help, Javier. I have already added the bug.


Log in to post a comment.