With all the different ways to do the same thing in JOOQ it's often
difficult to find the best approach. I'm trying to write up our basic jOOQ
idioms. In doing so I was wondering if their is any difference between
these two variants?
List<MyObject> results = select.fetch(this::toMyObject);
And:
List<MyObject> results =
select.fetch().stream().map(this::toMyObject).collect(Collectors.toList());
The latter is more verbose but is a standard idiom that allows me to build
my own collection types, Maps, or groupings. Which actually leads me to
wonder why there is a bunch of fetchSet methods but no:
Set<MyObject> results = select.fetchSet(this::toMyObject);
Why have so many fetchSet methods but none that takes a record mapper? From
my perspective there are just too many options in jOOQ. Ever seen that
movie The Wonder Boys? It's basically about a brilliant author who lost the
ability to edit himself resulting in a novel that was too long for anyone
to follow. :) Might it be time to start deprecating methods. For example,
fetch().stream() can do almost everything. Or you could even make a more
general purpose collecting fetch and get rid of the rest of all of them.
fetch(RecordMapper<...>, Collector<...>);
So two requests:
1. What are the primary query patterns (canonical approaches)
2. Please start deprecating methods. :)
--
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.