最近在使用webservice的时候接受客户端的字符串,是使用xml或者json格式的字符串.
     在对应的句javaBean中直接使用String类型保存,数据库后台使用的是Clob字段对应.
     代码如下类似:

import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;@SuppressWarnings("serial")
@Entity
@Table(name = "T_BCL_BIZINSTRUCTIONDOCUMENTS")
public class TBclBizinstructiondocument implements java.io.Serializable {
     private Long bizinstructiondocid;       //业务系统传递过来的数据Id
     private Date receivedate;                  //业务系统传递过来的数据时间
     private String instructioncomment;    //业务系统传递过来的数据内容  注意:此处使用Sring,后台是clob字段 
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "bizinstructiondocid_sequence")
    @SequenceGenerator(name = "bizinstructiondocid_sequence", allocationSize = 1,sequenceName = "bizinstructiondocid_sequence") 
   @Column(name = "BIZINSTRUCTIONDOCID", unique = true, nullable = false, precision = 16, scale = 0)
   public Long getBizinstructiondocid() {
      return bizinstructiondocid;
    }
 
   public void setBizinstructiondocid(Long bizinstructiondocid) {
        this.bizinstructiondocid = bizinstructiondocid;
    }
 
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "RECEIVEDATE", length = 14)
    public Date getReceivedate() {
       return receivedate;
    }
 
   public void setReceivedate(Date receivedate) {
       this.receivedate = receivedate;
   }
 
   @Lob 
   @Basic(fetch = FetchType.EAGER) 
   @Column(name="INSTRUCTIONCOMMENT", columnDefinition="CLOB", nullable=true) 
   public String getInstructioncomment() {
       return instructioncomment;
    }
 
    public void setInstructioncomment(String instructioncomment) {
        this.instructioncomment = instructioncomment;
     } 
}

记录如下:对应的Java字段使用String类型,后台数据库oracle中对应Clob字段.

注解使用:

@Lob 
@Basic(fetch = FetchType.EAGER) 
@Column(name="INSTRUCTIONCOMMENT", columnDefinition="CLOB", nullable=true)

目前保存做个记录备份处理