How to create a BLOB column for a List<byte[]>


On Tue, Sep 7, 2021 at 06:31 PM, Andy wrote:

Mark the field as serialised for a start.

Thank you Andy. @Serialized solved the problem.


Mark the field as serialised for a start. Then look at SchemaTool "dbinfo" output and see if your database even supports "BLOB" type in the info it provides via JDBC DatabaseMetaData


Hello all,

I a persisted class I have the following two instance variables:

  private List<File> referenceFiles = new ArrayList<>();
  private List<byte[]> referenceFilesContent = new ArrayList<>();

where the first is keeping the file paths as File objects, and the second their content. The problem here is that the content can be large (image, for example) and when the DB is created the content column is a LONGVARBINARY with a DB type of LONG VARCHAR FOR BIT DATA, whose unchangeable length is 32700 bytes.

I've tried adding @Column(jdbcType = "BLOB") on the referenceFilesContent variable (and then @Column(jdbcType = "BLOB", sqlType = "BLOB")) but nothing changed (I'm using DataNucleus 6.0.0-m1 on a Derby java DB).

How can solve this issue?