Hi Samir and Lukas
Samir's proposal is fairly DB specific, which I would like to avoid. Using jOOQ-meta would make it a bit more cross DB, but then table creation/deletion will be done at runtime, so I can't cache the outcome and so the overhead would be over the top.
Another option would be to use DSLContext.meta() to query the dictionary views via JDBC's DatabaseMetaData (or use the latter directly).
I'll look into this one, thx :)
By the way
I'm a bit annoyed by the extra exception (and stack compilation), for the performance cost, but I haven't found any better way.
I wouldn't worry about the stack compilation too much in the event of a database query. Even the latency produced by the TCP/IP connection is very likely to outshine any exception cost in Java :)
Indeed, you're deeply right.
Besides that, jOOQ-meta also does this internally, e.g. to see if it runs on Oracle 12, 11, or 10. It just checks if a column is available from a dictionary view by selecting it. On error: Not available.
Ok, good to know: it's not too crazy to proceed this way.
In the end, would you advise using DatabaseMetaData or seeing if an exception comes back ?
Thanks again all :)