Java 使用jasypt加密@Lob byte[]列类型

Java 使用jasypt加密@Lob byte[]列类型,java,encryption,orm,jasypt,lob,Java,Encryption,Orm,Jasypt,Lob,我正在尝试用jasypt加密byte[]字段 加密前我的代码 @Entity public class ContentFile { ... @Column(name = "fileContent") @Lob private byte[] fileContent; ... } 通常这会在数据库中映射到oracle和h2中的BLOB,我使用它。 现在,在添加加密后,我有了这样的东西 @TypeDef(name = TypeDefName.ENCRYPTED_BYTE_ARRAY, typeCla

我正在尝试用jasypt加密byte[]字段

加密前我的代码

@Entity
public class ContentFile {
...
@Column(name = "fileContent")
@Lob
private byte[] fileContent;
...
}
通常这会在数据库中映射到oracle和h2中的BLOB,我使用它。 现在,在添加加密后,我有了这样的东西

@TypeDef(name = TypeDefName.ENCRYPTED_BYTE_ARRAY, typeClass = EncryptedBinaryType.class, parameters = { @Parameter(name = TypeDefParamName.ENCRYPTOR_REGISTERED_NAME, value = EncryptorRegisteredName.HIBERNATE_BINARY_ENCRYPTOR) })
@Entity
public class ContentFile {
...
@Type(type = TypeDefName.ENCRYPTED_BYTE_ARRAY)
@Column(name = "fileContent")
@Lob
private byte[] fileContent;
...
}
但是生成的模式现在不同了——我在Oracle中得到原始值(255),在H2中得到二进制值(255),当然这会产生错误,因为字节数组要大得多。 看起来在放置@Type时会忽略@Lob,那么有没有办法告诉jasypt/hibernate这个字节[]实际上应该是一个BLOB