Hibernate - How to set sql type by annotation?

I have a file as a byte [] fileContent. My mySql schema is generated by Hibernate and, by default, hibernate sets the sql type of fileContent for the BLOB.

But the blob is not big enough for my files. I will need at least MEDIUMBLOM or even LONGBLOB.

But how can I annotate my field so that Hibernate will generate a schema with my field as LONGBLOB? I have a google search for 2 hours without getting anything ...

Shouldn't it be such a simple and general task that it should be documented somewhere?

Please help a frustrated programmer!

@WhatAnnotationCanIUseToForceHibernateToMakeThisALONGBLOB???? private byte[] fileContent; 
+6
source share
1 answer

You tried

 @Column(columnDefinition = "LONGBLOB") private byte[] fileContent; 
+21
source

Source: https://habr.com/ru/post/895165/


All Articles