Hi Robert,
There are several reasons why jOOQ doesn't formally support LOBs in client
API right now, as opposed to their semantically equivalent "base types"
String (for CLOB) and byte[] (for BLOB). I'm listing this to give some
context here:
1. jOOQ aims for hiding all JDBC details from jOOQ client API.
Specifically, Clob and Blob are quite "harsh" APIs with quite a few caveats
that may even depend on JDBC driver specifics.
2. Clob and Blob are resources with open connections to the database.
This makes no sense in an ordinary jOOQ context, when eagerly fetching all
the results through fetch() methods. fetchLazy() and fetchStream() might be
candidates where Clob and Blob types could make sense as the underlying
ResultSet and PreparedStatement are still open while consuming these
resources.
3. ByteArray{ Input | Output }Stream are two different types which
cannot be represented as a single Field<T> type. If they would be chosen as
<T> types, 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 Clob
and Blob
4. 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.
So, perhaps what jOOQ offers is sufficient for you already? I definitely
think that manual section could be improved though.
Lukas
2017-07-29 1:09 GMT+02:00 <[email protected]>:
> Hi Lucas,
>
> I'm looking to store user profiles in a DB (postgresql) and thinking to
> store a profile photo for each user in the User table. Unfortunately the
> Manual
> <https://www.jooq.org/doc/3.9/manual/reference/reference-data-types/data-types-lobs/>
> says jOOQ doesn't support BLOBs.
>
> However, it also says they are mapped to byte[], which might work in my
> case (profile photos should be fairly small) if I'd be able to read and
> write them using a ByteArrayOutputStream/ByteArrayInputStream or similar.
> How can I do that? Can I still use jOOQ's code generation?
>
> Is there support for BLOBs planned in the near future?
>
> Thank you,
> Robert
>
> --
> 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.
>
--
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.