`
xhcat1025
  • 浏览: 4694 次
  • 来自: ...
最近访客 更多访客>>
社区版块
存档分类
最新评论

Hibernate 插入 MySQL LongText 异常

阅读更多
一、异常如下:

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>

插入不到数据库表中。

分享到:
评论
4 楼 xhcat1025 2007-03-23  
问题不在这里,原因我写到我的另一博客了
http://maomao.blog.51cto.com
3 楼 saysoc 2007-03-20  
content类型不对吧,换个可以装大数据的类型
2 楼 xhcat1025 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>

插入少量可以,但内容多的话就报错了。
1 楼 coolyi88 2007-03-20  
大哥...
我真想顶你几下呢..
加个ID字段就OK了...
记得改配置文件呢..

相关推荐

Global site tag (gtag.js) - Google Analytics