Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate - How to set sql-type by annotation?

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

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

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

Shouldn't this be a so simple and common task that it should be documented somewhere??

Please help a frustrated programmer!!

@WhatAnnotationCanIUseToForceHibernateToMakeThisALONGBLOB????
private byte[] fileContent;
like image 922
user829237 Avatar asked Aug 16 '11 15:08

user829237


1 Answers

Have you tried

@Column(columnDefinition = "LONGBLOB")
private byte[] fileContent; 
like image 194
axtavt Avatar answered Oct 17 '22 12:10

axtavt