日期:2014-05-16  浏览次数:20387 次

(转)Hibernate的Annotation中实体BLOB、CLOB类型的注解
在Hibernate Annotation中,实体BLOB、CLOB类型的注解与普通的实体属性有些不同,具体操作如下:?
?
BLOB类型的属性声明为byte[]或者java.sql.Blob:?
?
@Lob?
@Basic(fetch=FetchType.LAZY)?
@Column(name="IMGS", columnDefinition="BLOB", nullable=true)
private?byte[]?imgs;?
?
public byte[] getImgs() {?
???return this.imgs;?
}?
?
public void setImgs(byte[] imgs) {?
???this.imgs= imgs;?
}?
?
//下面的例子就是用的java.sql.Blob
@Lob?
@Basic(fetch=FetchType.LAZY)?
@Column(name="IMGS", columnDefinition="BLOB", nullable=true)
private?Blob?imgs;?
?
public Blob getImgs() {?
???return this.imgs;?
}?
?
public void