HibernateAnnotation中BLOB、CLOB注解的写法
来源:优易学  2011-12-30 10:24:52   【优易学:中国教育考试门户网】   资料下载   IT书店
  在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;
  }
  按照以上的设置实体类的注解就搞定了。

责任编辑:小草

文章搜索:
 相关文章
没有相关文章
热点资讯
资讯快报
热门课程培训