Thanks David,
It compiled just fine but I got a nullpointer exception for some
reason. For now I'll use the findAllByPreparedStatement method instead
so I can play along with my project.

Thanks for the help though :)

On Jan 5, 6:01 pm, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> Lift uses the SQL IN statement rather than joins.  This has a negative
> impact for users of MySQL and Derby.
>
> Try:
>
> TagUser.findAll(By(TagUser.tag, this), In(TagUser.user, User.id,
> OrderBy(User.followers_count, Descending), MaxRows[User](10)))
>
>
>
>
>
> On Mon, Jan 4, 2010 at 11:10 PM, Mads Hartmann <mads...@gmail.com> wrote:
> > My ultimate goal would be to only pull out the top x users. I'm
> > currently using the following code to achieve this:
>
> > TagUser.findAll(By(TagUser.tag, this.id)).map(_.user.obj.open_!)
> >            .sort(_.followers_count.is > _.followers_count.is)
> >           .take(x)
>
> > But im concerned that this creates an instance for each of the users
> > in tag tag even though i only need the top x.
>
> > Thanks for helping me out :)
>
> > On Jan 5, 1:47 am, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> > > 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
> > > >  >
> > <liftweb%2bunsubscr...@googlegroups.com<liftweb%252bunsubscr...@googlegroup 
> > s.com>>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/liftweb?hl=en.
>
> > > --
> > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > Beginning Scalahttp://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<liftweb%2bunsubscr...@googlegroups.com 
> > >
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/liftweb?hl=en.
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://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