Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: All entities loaded when show method called for just one

  1. #11
    Join Date
    Oct 2010
    Posts
    29

    Default

    Has anybody else experienced this behavior? I had originally posted this in the data forum, apparently a mod has decided this is a ROO issue.

    I think I'll file a jira ticket.

    Ticket logged https://jira.springsource.org/browse/ROO-2943
    Last edited by ArjunSol; Nov 30th, 2011 at 03:50 AM. Reason: adding jira ticket

  2. #12
    Join Date
    Oct 2010
    Posts
    29

    Default

    OK so I've tracked down the cause of this.

    The controllers that get generated by roo have the @ModelAttribute annotation attached to several populate methods. See this for more info.

    This causes a rather heavy query of findAllPlanets to be called and added to the ui Model on every request, even if the view doesn't require it. That's naughty.

    At the moment my solution is to push these methods in and return null. e.g. from the pet clinic sample.

    This method from PetController_Roo_Controller.aj

    Code:
    @ModelAttribute("pets")
        public Collection<Pet> PetController.populatePets() {
            return Pet.FindAllPets();
    }
    Becomes the follwoing in PetController.java

    Code:
    @ModelAttribute("pets")
        public Collection<Pet> populatePets() {
            return null;
    }
    But something more elegant is definitely required.
    Last edited by ArjunSol; Nov 30th, 2011 at 09:44 AM. Reason: added example fix

  3. #13
    Join Date
    May 2006
    Location
    Madrid
    Posts
    383

    Default

    I'm glad you've found the reason. I had no time to watch this.

    There's a POST and a JIRA ticket on this regard, but now I don't remember any of them.

  4. #14
    Join Date
    Jun 2010
    Posts
    440

    Default

    This is a very-very sad programming issue... Unfortunately, It has been dangling there forever.
    I reported -and fixed- long time ago in http://pragmatikroo.blogspot.com/201...libration.html.

    What is ever more disturbing is that none of the documentation available on Roo -including books-, take care of it.

    This just a little example of having other product advocates and book writers than the "official" ones would be on the best interest of everybody vested in SR.


    B. Roogards
    jD
    Last edited by delgad9; Dec 1st, 2011 at 08:58 AM. Reason: clean up

  5. #15
    Join Date
    Oct 2010
    Posts
    29

    Default

    Hi JD,

    The post seems to be a story of you fixing a performance issue. Sadly no technical detail at all. Would you care to go into detail? I'm sure we'd all benefit if you've found anything we may have missed.

  6. #16
    Join Date
    Jun 2010
    Posts
    440

    Default

    @aRJUNsOL,

    Two Spring Roo "true stories*" at https://pragmatikroo.org/showcases for you to check out...

    I've been trying to get the attention of SR stakeholders and book publishers -for supporting my work- for properly sharing a lot of SR stuff.

    As you stated
    I'm sure we'd all benefit...
    I need to be included in the ALL that you mentioned.



    B. Roogards
    jD
    *Best results using Chrome
    Last edited by delgad9; Dec 2nd, 2011 at 08:29 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •