Hibernate Annotation中,实体BLOB、CLOB类型的注解
在hibernate Annotation中,实体BLOB、CLOB类型的注解与普通的实体属性有些不同,具体操作如下:
BLOB类型,类型声明为byte[]:
private byte[] content; |
注解:
@Lob @Basic(fetch=FetchType.LAZY) @Column(name="CONTENT",columnDefinition="BLOB",nullable=true) publicbyte[]getContent(){ returnthis.content; } publicvoidsetContent(byte[]content){ this.content=content; } |
CLOB类型,类型声明为String即可:
private String remark; |
注解:
@Lob @Basic(fetch=FetchType.EAGER) @Column(name="REMARK",columnDefinition="CLOB",nullable=true) publicStringgetRemark(){ returnthis.remark; } publicvoidsetRemark(StringrecvdocRemark){ this.remark=remark; } |
按照以上的设置实体类的注解就搞定了。
相关推荐
周公周金桥 2020-09-06
大象从不倒下 2020-07-31
AlisaClass 2020-07-19
MaureenChen 2020-04-21
xingguanghai 2020-03-13
teresalxm 2020-02-18
木四小哥 2013-05-14
SoShellon 2013-06-01
Simagle 2013-05-31
羽化大刀Chrome 2013-05-31
waterv 2020-01-08
LutosX 2013-07-29
vanturman 2013-06-27
wutongyuq 2013-04-12
luoqu 2013-04-10
today0 2020-09-22
89520292 2020-09-18
bigname 2020-08-25