On Mon, Jan 4, 2010 at 3:24 PM, Mads Hartmann <mads...@gmail.com> wrote:

> Hello, I'm having a problem and I'm sure it's an easy fix for someone
> with a bit more experience
>
> I have 3 model classes: tag, user, tweet and a join class TagUser. A
> tag has a list of users.
>
> If i want all of the users in a tag i use the following code (which
> works):
>
> def users = TagUser.findAll(By(TagUser.tag, this.id)).map
> (_.user.obj.open_!)
>
> my problem is that i can't figure out how to apply queryparams so i
> don't pull out all of the users from the DB if i don't need em. I was
> thinking something like this (doesn't compile):
>
> def getTopUsers(in: Int) :List[User] = {
>    TagUser.findAll(By(TagUser.tag, this.id),
>                       OrderBy(User.followers_count, Descending),
>                       MaxRows(in))
>

There is an issue:

OrderBy(User.xxxx, Descending) // illegal... you can only order by a
TagUser.xxx field

And a potential issue:

MaxRows[TagUser](in) // sometimes the Type Inferencer doesn't get it right.


What's your ultimate goal?




> }
>
> I get the following error:
> [ERROR] ... error: overloaded method value findAll with alternatives
> (net.liftweb.mapper.QueryParam[scalableKvidr.model.TagUser]*)List
> [scalableKvidr.model.TagUser] <and> ()List
> [scalableKvidr.model.TagUser] cannot be applied to
> (net.liftweb.mapper.Cmp
> [scalableKvidr.model.TagUser,Long],net.liftweb.mapper.OrderBy
> [scalableKvidr.model.User,Int],net.liftweb.mapper.MaxRows[Nothing])
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to
> liftweb+unsubscr...@googlegroups.com<liftweb%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.


Reply via email to