在 Hibernate 中如何注释 blob 列? [英] How is a blob column annotated in Hibernate?

查看:13
本文介绍了在 Hibernate 中如何注释 blob 列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Hibernate 中注释 blob 列?到目前为止,我有一堂课:

How is a blob column annotated in Hibernate? So far I have a class that has:

@Column( name = "FILEIMAGE" )
private byte[ ] fileimage ;
//
public byte[ ] getFileimage ( ) { return this.fileimage ; }
public void setFilename ( String filename ) { this.filename = filename ; }

推荐答案

@Lob 应该可以处理 blob 和 clob(使用 String 作为类型)

@Lob should do the trick for blob and clob (use String as type)

@Column( name = "FILEIMAGE" )
@Lob(type = LobType.BLOB)
private byte[] fileimage;

这篇关于在 Hibernate 中如何注释 blob 列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆