Hibernate 插入 MySQL LongText 错误

Hibernate 插入 MySQL LongText 错误

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>

插入不到数据库表中。

1 楼 coolyi88 2007-03-20  

大哥…

我真想顶你几下呢..

加个ID字段就OK了…

记得改配置文件呢..

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>

插入少量可以,但内容多的话就报错了。

3 楼 saysoc 2007-03-20  

content类型不对吧,换个可以装大数据的类型

4 楼 xhcat1025 2007-03-23  

问题不在这里,原因我写到我的另一博客了

http://maomao.blog.51cto.com

Hibernate 插入 MySQL LongText 错误

相关文章:

你感兴趣的文章:

标签云: