Lukas Eder makes a recommendation:
Why, yes of course! jOOQ is in full control of your SQL statement and knows exactly what column (and data type) is at which position, because you helped jOOQ construct not only the query object model, but also the result structure. So, a much faster index access is possible, compared to the much slower column name access.
The same is true for ordinary result sets, by the way, where jOOQ always calls JDBC’s
ResultSet.getString(int)
, for example, overResultSet.getString(String)
. Not only is it faster, but also more reliable. Think about duplicate column names, e.g. when joining two tables that both contain anID
column. While JSON is not opinionated about duplicate object keys, not all JSON parsers support this, let alone JavaMap
types.
Read on for some insight into when you might want to choose either of the two approaches, and why Lukas went with JSON arrays instead of JSON objects for object serialization in jOOQ.