论坛首页 入门技术论坛

Hibernate 插入 MySQL LongText 异常

浏览 5257 次
该帖已经被评为新手帖
作者 正文
   发表时间:2007-03-20  
一、异常如下:

14:30:50,484 ERROR JDBCExceptionReporter:72 - Data truncation: Data too long for column 'content' at row 1
org.hibernate.exception.GenericJDBCException: could not insert: [com.jh.xh.hibernate.pojo.InfoTab]

二、程序代码:

private String content;
   
public void setContent(String content) {
      this.content = content;
}
public String getContent() {
      return this.content;
}

对应xml配置:

<property name="content" type="text">
   <column name="content" />
</property>

插入不到数据库表中。

   发表时间:2007-03-20  
大哥...
我真想顶你几下呢..
加个ID字段就OK了...
记得改配置文件呢..
0 请登录后投票
   发表时间:2007-03-20  
coolyi88 写道
大哥...
我真想顶你几下呢..
加个ID字段就OK了...
记得改配置文件呢..
private Integer id;

public Integer getId() {
        return this.id;
    }
   
    public void setId(Integer id) {
        this.id = id;
    }


<id name="id" type="java.lang.Integer">
<column name="Id" />
<generator class="native"></generator>
</id>

插入少量可以,但内容多的话就报错了。
0 请登录后投票
   发表时间:2007-03-20  
content类型不对吧,换个可以装大数据的类型
0 请登录后投票
   发表时间:2007-03-23  
问题不在这里,原因我写到我的另一博客了
http://maomao.blog.51cto.com
0 请登录后投票
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics