开发者

Hibernate - How to set sql-type by annotation?

开发者 https://www.devze.com 2023-03-28 17:17 出处:网络
I have a file as a byte[] fileContent. My mySql-s开发者_运维知识库cheme is generated by Hibernate and by default hibernate sets the sql-type of fileContent to BLOB.

I have a file as a byte[] fileContent. My mySql-s开发者_运维知识库cheme 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;


Have you tried

@Column(columnDefinition = "LONGBLOB")
private byte[] fileContent; 
0

精彩评论

暂无评论...
验证码 换一张
取 消