Yeah, sorry for being so abstract :-(
Here's the code that works for me:
return db.execute(ctx -> {
Record r = ctx.select().
from(PREFIXES).
where(PREFIXES.NATIONAL.eq(prefix + "")).
fetchOne();
if (r == null) {
return null;
}
return r.map(PREFIX_MAPPER);
});
This query can only ever return 0 or 1 rows. So I was wondering how to
get rid of the check for the null Record instance.
Does that make sense?
On Fri, Jun 27, 2014 at 4:10 PM, Lukas Eder <[email protected]> wrote:
> Ben, I'm sorry, but I don't really know what you're asking me :-)
> What are you looking for? Can you provide an example?
>
>
> 2014-06-27 17:05 GMT+02:00 Ben Hood <[email protected]>:
>>
>> Hey Lukas,
>>
>> Using 3.4 API on JDK8 I was wondering what the idiomatic way is of
>> chaining a map() onto a fetchOne() that could return null. Using
>> fetchOneInto(classDef) seems to handle this internally, which works in
>> a number of cases, but the map() API is more flexible. Or do you have
>> to use some kind of Scala-esque Option?
>>
>> Cheers,
>>
>> Ben
>>
>> --
>> 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.
>
>
> --
> 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.
--
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.