Hello Lukas,
the issue is not a big one, as there is always a different way to do it
:o). I have just thought, that it could help to post such an info. My
example:
import org.jooq.scala.Conversions._
import scala.collection.JavaConversions._
val responses = for (r <- db
select(
CONVERSATION.RESPONSE
)
distinctOn CONVERSATION.USER_ID
from
CONVERSATION
where (CONVERSATION.USER_ID === userId)
and CONVERSATION.RESPONSE.isNotNull
orderBy (CONVERSATION.USER_ID.desc, CONVERSATION.UPDATE_DATE.desc)
fetch
) yield r.value1
Of course this could be replaced by using fetch(int):
val responses = (db
select(
CONVERSATION.RESPONSE
)
distinctOn CONVERSATION.USER_ID
from
CONVERSATION
where (CONVERSATION.USER_ID === userId)
and CONVERSATION.RESPONSE.isNotNull
orderBy (CONVERSATION.USER_ID.desc, CONVERSATION.UPDATE_DATE.desc)
fetch(CONVERSATION.RESPONSE))
where brackets are necessay to use the nice DSL (to border the statement).
Best regards,
Gabriel
On Tuesday, March 31, 2015 at 2:32:14 PM UTC+2, Gabriel Forró wrote:
>
> Hello,
>
> I just want to share an unexpected feature of the org.jooq.Result type in
> for comprehensions in Scala:Recently I have started to use jooq in a scala
> project. The 'map' method in the org.jooq.Result prevents to apply yielding
> for Result type in for comprehensions. The reason is the 'map' method name,
> as it has the same name as the Scala's FilterMonadic and therefore the
> implicit conversion is not applied to the Result and the yield's return
> type is not the correct one.
>
> Best regards,
>
> Gabriel
>
>
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.