Feb 24th, 2010, 08:27 AM
Why finders return Query
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.
Feb 24th, 2010, 12:08 PM
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.
Feb 25th, 2010, 05:20 AM
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