你的实体类有没有实现serializable接口? 对象序列化出错 比如 public class BaseBusinessClass implements Serializable{ private String id; private String name;
public String getId(){ return id; } public void setId(String id){ this.id=id; } public String getName(){ return name; } .....
could not deserialize,不能反序列化,你看看你的hibernate配置中是否有序列化类型数据,即SerializableType,与对应的数据库数据是否相同,(数据库对应blob型),还有你是否有换过jdk,不同的jdk序列化的时候得到的结果是不同的,如果保存数据的时候用的是一个版本的jdk,而读数据(即反序列化的时候)是另一个版本的jdk那么有可能反序列化不成功。
<?xml version="1.0" encoding='UTF-8'?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" ><!-- DO NOT EDIT: This is a generated file that is synchronized --> <!-- by MyEclipse Hibernate tool integration. --> <!-- Created Mon Aug 07 10:57:36 CST 2006 --> <hibernate-mapping package="bo"> <class name="Article" table="article"> <id name="articleId" column="article_id" type="string"> <generator class="assigned"/> </id>
对象序列化出错
比如
public class BaseBusinessClass implements Serializable{
private String id;
private String name;
public String getId(){
return id;
}
public void setId(String id){
this.id=id;
}
public String getName(){
return name;
}
.....
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" ><!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<!-- Created Mon Aug 07 10:57:36 CST 2006 -->
<hibernate-mapping package="bo"> <class name="Article" table="article">
<id name="articleId" column="article_id" type="string">
<generator class="assigned"/>
</id>
<property name="articleTitle" column="article_title" type="string" />
<property name="domainId" column="domain_id" type="string" />
********* <property name="articleText" column="article_text" type="serializable" />
<property name="goodFlg" column="good_flg" type="byte" />
<property name="lockFlg" column="lock_flg" type="byte" />
<property name="topFlg" column="top_flg" type="byte" />
<property name="readTimes" column="read_times" type="integer" />
<property name="replyTimes" column="reply_times" type="integer" />
<property name="lastReply" column="last_reply" type="string" />
<property name="lastReplyTime" column="last_reply_time" type="timestamp" />
<property name="addUser" column="add_user" type="string" />
<property name="addDate" column="add_date" type="timestamp" />
<property name="updUser" column="upd_user" type="string" />
<property name="updDate" column="upd_date" type="timestamp" />
</class>
</hibernate-mapping>
这个是影射的XML文件,打*的行是用的text类型
对应的类也实现了serializable接口