Thanks a lot for your feedback, Mark!

2016-07-12 22:41 GMT+02:00 Mark Derricutt <[email protected]>:

>
> On Thu, Jul 7, 2016 at 12:16 AM, Lukas Eder <[email protected]> wrote:
>
>> What's your biggest "itch" in the jOOQ API, which jOOQ could "scratch",
>> or rather, make go away by adding new convenience API?
>>
>
> One that I hit yesterday, using fetchOne() which returns a null if absent,
> error if more than 1.  What I would ideally have had was "fetchUnique"
> which would error on anything BUT 1 result, or a "fetchOptional".
>

That is interesting indeed. After all these years, I suspect I've gotten
used to the inconsistency created by the fetchOne() API contract... Note
that jOOQ 3.7 introduced ResultQuery.fetchOptional, which returns an
Optional<R>:
http://www.jooq.org/javadoc/latest/org/jooq/ResultQuery.html#fetchOptional--

(and still throws an exception if there are too many results)

In a way, fetchOne() *is* fetchUnique(), except that it will throw a NPE
later on rather than a NoRecordFoundException :) On a more serious note,
indeed, that would certainly add value as it clearly communicates the
intention of a query to return exactly one record (e.g. when implementing
optimistic locking, etc.) I've registered a feature request for this:
https://github.com/jOOQ/jOOQ/issues/5411

Thanks a lot for providing feedback!

"Great artists are extremely selfish and arrogant things" — Steven Wilson,
> Porcupine Tree
>

Excellent, I'll have to remember this :)

-- 
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.

Reply via email to