Probably a good idea - this would probably save the world from me
using the JOOQ API to subvert PostgreSQL into doing multi-column pivot
queries, when you could just use Oracle natively for that kind of
thing :-)
> Nice. I always like it when statements end with "OR ELSE!!!" ;-)
Actually I'm going to take everything I ever said back (thank god I'm
transactional) - you've inadvertently convinced me of a better way.
I've just actually read the Optional API (first time I've RFTM'ed
something in a while) and it has this neat thing called orElseThrow().
With this I can change my API to
Optional<Prefix> getPrefix(prefix);
And then at a higher layer I can do this:
return api.getPrefix(prefix).orElseThrow(ResourceNotFoundException::new);
Every day is a school day :-)
> But I like that alternative of yours. It's a sign that some jOOQ features
> can slowly transition towards more idiomatic Java 8 code. There was this
> blog post here, that also showed how more complex transformations on jOOQ
> records can be performed once the org.jooq.Result<R> is transformed into a
> JDK Stream<R>:
>
http://blog.jooq.org/2014/04/11/java-8-friday-no-more-need-for-orms/
Yes, I liked that article - FWIW back in the day, I did really like
using the JOOQ API with Scala to get a really terse and expressive
handle on non-trival DB queries. Hopefully some of that Kool-Aid can
be drunk with Java.
> What's that db.execute thing, btw?
Just some glue from my project, nothing really to write home about,
but here's the definition in any case:
https://gist.github.com/0x6e6562/95844ed3ef981a0c227b