[2.0] spanM still part of Anorm?

411 views
Skip to first unread message

Ike

unread,
Mar 11, 2012, 1:25:50 PM3/11/12
to play-fr...@googlegroups.com
Hi all,

I can't find any references in the current documentation of in the sample apps for Anorm parsers that span multiple rows.For example, if I have an order/order-line-item relationship, and I do a join query that returns multiple rows per per order (one row for each order line item), what's the proper way to parse this with Anorm in 2.0?

order ~ spanM(orderDetail)

??

Guillaume Bort

unread,
Mar 11, 2012, 9:12:11 PM3/11/12
to play-fr...@googlegroups.com
We decided to remove it. It makes parsers really complicated, and it
is way simpler to deal with that with the Scala collection API
(usually using the groupBy operation)

So parse order ~ orderDetail, get a Seq[Order~OrderDetail] and then
deal with it in the Scala collection API like seq.groupBy(_._1)

> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/h-w4thlpthMJ.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to
> play-framewor...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/play-framework?hl=en.

--
Guillaume Bort

Ike

unread,
Mar 11, 2012, 9:38:01 PM3/11/12
to play-fr...@googlegroups.com
OK, thanks. I'll try that approach.


On Sunday, March 11, 2012 9:12:11 PM UTC-4, Guillaume Bort wrote:
We decided to remove it. It makes parsers really complicated, and it
is way simpler to deal with that with the Scala collection API
(usually using the groupBy operation)

So parse order ~ orderDetail, get a Seq[Order~OrderDetail] and then
deal with it in the Scala collection API like seq.groupBy(_._1)

On Sun, Mar 11, 2012 at 6:25 PM, Ike <> wrote:
> Hi all,
>
> I can't find any references in the current documentation of in the sample
> apps for Anorm parsers that span multiple rows.For example, if I have an
> order/order-line-item relationship, and I do a join query that returns
> multiple rows per per order (one row for each order line item), what's the
> proper way to parse this with Anorm in 2.0?
>
> order ~ spanM(orderDetail)
>
> ??
>
> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/h-w4thlpthMJ.

> To post to this group, send email to play-framework@googlegroups.com.


> To unsubscribe from this group, send email to

> play-framework+unsubscribe@googlegroups.com.


> For more options, visit this group at
> http://groups.google.com/group/play-framework?hl=en.

--
Guillaume Bort

Reply all
Reply to author
Forward
0 new messages