BLOBs and CLOBs
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
Blob are resources (but not
java.lang.AutoCloseable!) with open connections to the database. This makes no sense in an ordinary jOOQ context, when eagerly fetching all the results through
fetchStream() might be candidates where
Blob types could make sense as the underlying
java.sql.PreparedStatement are still open while consuming these resources.
ByteArrayOutputStream on the other hand are two different types which cannot be represented as a single
Field<T> type. If either would be chosen as the
<T> type, we'd get read-only or write-only fields. So for full lazy streaming support, we'd need another 2-way wrapper type, similar to
In many cases, streaming binary data isn't really necessary as the
byte can be easily kept in memory (and it is done so for further processing anyway, e.g. when working with images), so the extra work might not really be needed. This is particularly true in Oracle, where BLOBs are the only binary types in the absences of a formal (VAR)BINARY type, and CLOBs start at 4000 bytes.
If you want to override jOOQ's default behaviour, use either
org.jooq.impl.BlobBinding, see custom data type bindings as well as using a binding in code generation for more details.