0

Using Squeryl ORM and Scala. For the first time I did a JOIN statement that used grouping. Admittedly, I can't figure out how to start iterating through the contents.

Here's the JOIN:

join(DB.jobs, DB.users.leftOuter, DB.clients.leftOuter, DB.projects.leftOuter)((j,u,c,p) =>
      where((j.teamId === teamId)
        and (j.startTime > yesterdayBegin))
      groupBy(j.userId)
      on(j.userId === u.map(_.id), j.clientId === c.map(_.id), j.projectId === p.map(_.id)))

How do I print out its contents?

I tried:

Job.teamTimeline( teamId(request) ).map{ user => Map(
        "name" -> user._1.map(_.name).getOrElse("Pending")
      )}

But got the compiler error:

value _1 is not a member of org.squeryl.dsl.Group[Option[org.squeryl.PrimitiveTypeMode.LongType]]
4

1 回答 1

0

Max the great was able to help out on the mailing list. I almost had the syntax right.

His response:

replace :

groupBy(j.userId)

by:

groupBy(j.userId, j.name)

then :

timelineLookup.map{ group => Map(

        "name" -> group.key._2.getOrElse("Pending")

      )}

Source: https://groups.google.com/forum/?fromgroups#!topic/squeryl/sJ05He-4F3I

于 2012-07-20T14:57:35.213 回答