Hbernate CLOB类型映射
CLOB类型,在实体里声明为String即可,下面是示例代码@Entity@Table(name="Test")@SequenceGenerator(name="SEQ_STORE",sequenceName="member_id_sequence")public class Test extends AutoIDEntity{private String netaddr;private String name;public String getNetaddr() {return netaddr;}public void setNetaddr(String netaddr) {this.netaddr = netaddr;}@Lob@Basic(fetch = FetchType.EAGER)@Column(name="name", columnDefinition="CLOB", nullable=true) public String getName() {return name;}public void setName(String name) {this.name = name;}}在dao里面测试Test test=new Test();test.setNetaddr("test");StringBuffer sb=new StringBuffer();for(int i=0;i<10000;i++){sb.append("哈");}test.setName(sb.toString());entityDao.persist(test);String hql="from Test where netaddr=?";List<Test> list=entityDao.find(hql, "test");Test d=list.get(0);logger.debug(d.getNetaddr());logger.debug(d.getName());控制台打印出:11:41:44,449 DEBUG [DonateRecordServiceImpl] 哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈。。。。。。。省略n个字