[2.0] Anorm: Join query and parsers

138 views
Skip to first unread message

Pablo Fernandez

unread,
Nov 19, 2012, 4:39:27 PM11/19/12
to play-fr...@googlegroups.com
Can anyone point me to an example of how to perform a join sql query using 2 parsers? e.g: 

* User has N Tasks
* Task db table has user_id
* The result should be a User with a tasks: Set[Task] field

Thanks

Guillaume Bort

unread,
Nov 19, 2012, 4:50:11 PM11/19/12
to play-fr...@googlegroups.com, play-fr...@googlegroups.com
Start parsing the resultset as a Seq[User~Task] and then use the groupBy operation of the collection API to resolve it as Map[User,Task]
--
 
 

Pablo Fernandez

unread,
Nov 19, 2012, 4:58:04 PM11/19/12
to play-fr...@googlegroups.com
Isn't there a code example somewhere? seems like a common enough case not to be included with the play documentation 
Reply all
Reply to author
Forward
0 new messages