最近在使用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)
目前保存做个记录备份处理
相关推荐
运用Java如何存取Oracle中的CLOB类型字段
ORACLE中CLOB字段转String类型
JDBC读写Oracle的CLOB字段
把oracle数据库中字段类型为clob的字段值以字符串的形式读取出来
CLOB字段处理 对CLOB进行存取的例子
java读取oracle数据库中clob字段 把oracle数据库中字段类型为clob的字段值以字符串的形式读取出来
java操作oracle clob,基础教程,教你clob在java中的用法,简单易学。
关于在oracle数据库中读取clob大字段问题
java操作oracle clob,基础教程,教你clob在java中的用法,简单易学。
该类中包含有多个方法对数据库中的clob字段进行查询、插入、事物处理、批处理、调用存储过程等操作。使用的是myeclipse8.6,oracle11g,测试的时候执行手动建个表xml_buffer,包含id、xmlcontent字段即可,然后在...
oracleoracleoracleoracleoracleoracleoracleoracleoracleoracleoracleoracleoracleoracleoracleoracle
用Hiberate处理CLOB字段 ;通过Hiberate处理CLOB类型的数据;
sql server中的image类型的数据导出到oracle的clob字段中
oracle中使用jdbc读写clob字段,很多细节介绍,内容全面。
ActiveXObject和Clob字段的插入更新
介绍了利用Hibernate将一个长字符串转换为流存储至Clob字段中,然后再从Clob字段中读出来,转换为字符串输出的方式
数据库中clob类型转换的问题 数据库中clob类型转换的问题
JDBC方式操作CLOB字段实例代码 。