clob 对应java 类型_Clob字段和Java类中字段对应

最近在使用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)

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

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值