首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

Hibernate annotation Lob字段引文

2012-07-18 
Hibernate annotation Lob字段注解?在hibernate Annotation中,实体BLOB、CLOB类型的注解与普通的实体属性有

Hibernate annotation Lob字段注解

?在hibernate Annotation中,实体BLOB、CLOB类型的注解与普通的实体属性有些不同,具体操作如下:BLOB类型,类型声明为byte[]:

?

private byte[] content;

?

??? 注解:

?

@Lob?
@Basic(fetch = FetchType.LAZY)?
@Column(name = "CONTENT", columnDefinition = "BLOB",nullable=true)?
public byte[] getContent() {?
return this.content;?
}?

public void setContent(byte[] content) {?
this.content = content;?
}

?

??? CLOB类型,类型声明为String即可:

?

private String remark;

?

??? 注解:

?

@Lob?
@Basic(fetch = FetchType.EAGER)?
@Column(name="REMARK", columnDefinition="CLOB", nullable=true)?
public String getRemark() {?
return this.remark;?
}?

public void setRemark(String recvdocRemark) {?
this.remark = remark;?
}

?

??? 按照以上的设置实体类的注解就搞定了。

热点排行