Results 1 to 3 of 3

Thread: Why finders return Query

  1. #1
    Join Date
    Nov 2008
    Posts
    27

    Default Why finders return Query

    Hi,

    what was the reason for the finders generated using say:

    finder add --finderName findUsersByCode --class foo.bar.User

    to return a Query rather than a list of User - List<User>

    I dont want to use the Web part of ROO and so the Query object returned from the finder is exposed and coupled to my Service/Dispacher/Facade tier. There must be a reason for doing this, just cannot think of why.

  2. #2
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    We return the query object for convenience reasons. For example you may want to paginate over the result or add further attributes to the query which you would not otherwise be able to do.

    HTH,
    Stefan
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

  3. #3
    Join Date
    Nov 2008
    Posts
    27

    Default

    Hi Stefan

    I guess this makes things more flexible, but it also potentially introduces persistance code into my service or web tier.

    Infact, because Im working with my entities in a generic way, I've created a DAO to encapsulate my "extra" persistence logic. Not very ROO like I know but atleast my Query isnt going to be exposed.

    Thanks for the feedback

    Tim

Posting Permissions

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