java.sql2 minor feature request

Lukas Eder lukas.eder at gmail.com
Wed Oct 18 08:28:28 UTC 2017


Hello,

In my previous email [1], I was discussing potential annotation
enhancements. While I am personally not a big fan of annotations, I do
appreciate how they make client code more concise. One nice feature that is
derived from @SqlColumns is the fact that we can fetch the entire
Result.Row into a POJO in one go.

Now, POJOs are one way to get an entire row from a result set. Another one
would be an Object[] or List<Object> type (or a tuple, if Java had them).
This is the preferred approach for people who do not embrace nominal typing
as much as the OO folks in Java land do, specifically people who work in
more functional programming paradigms. In those cases, it would be really
cool if there was a method

Object[] Result.ResultMap.get()

... which would simply yield the entire Row contents. The Object[] type
seems well aligned with the String[] type returned from getIdentifiers(). I
would imagine this approach to be much cheaper than the alternative of
iterating the identifiers and then fetching them 1-by-1. That's something
that has been really missing in the classic JDBC API as well.

What do you think?
Lukas

[1]:
http://mail.openjdk.java.net/pipermail/jdbc-spec-discuss/2017-October/000186.html


More information about the jdbc-spec-discuss mailing list