Java 数据截断错误-数据对列太长

Java 数据截断错误-数据对列太长,java,mysql,jpa,Java,Mysql,Jpa,有趣的是,在实体中: public static final int maxContentSize = 2097152; //2Mb @Lob @Column(length=maxContentSize) private byte[] content; @Column(length = 100) private String mimetype; @Column(length = 50) private String fileName; 但是,某些文件(65-70k大小)插入正常,但大多数文件都

有趣的是,在实体中:

public static final int maxContentSize = 2097152; //2Mb
@Lob
@Column(length=maxContentSize)
private byte[] content;
@Column(length = 100)
private String mimetype;
@Column(length = 50)
private String fileName;
但是,某些文件(65-70k大小)插入正常,但大多数文件都会出现错误:

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'CONTENT' at row 1
在创建实体之前,我已经检查了大小是否正确。

根据JPA文档,“长度”仅用于字符串属性

(可选)列长度。(仅当使用字符串值列时适用。)

如果您正在使用工具自动生成DDL。。您可以使用“columnDefinition”属性

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

该表的模式定义是什么?我不是说这些JPA注释是什么。。。实际上是什么?哇。它是基于这个答案:但实际上它是一个blob列,工作文件现在是自动生成的,但我刚刚知道我们将使用oracledb,我们将编写模式定义。所以现在我将把这个列改为真正的中/长blob