以下是错误的堆栈跟踪:
org.springframework.orm.hibernate3.HibernateSystemException:无法反序列化;嵌套的异常是org.hibernate.type.SerializationException:无法反序列化 引起原因:org.hibernate.type.SerializationException:无法反序列化 在org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:217) 在org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:240)
下面是我的POJO课:
public static final class MemberName implements java.io.Serializable
{
/**
*
*/
private static final long serialVersionUID = 3832626162173359411L;
private String firstname;
private String lastname;
private String gender;
private String dexterity;
private String matchPreference;
private String tournamentEntry;
/*private Double rating;
private Double minRating=Double.valueOf(2.5);
private Double maxRating=Double.valueOf(5.0);*/
private Integer rating=null;
private Integer minRating=null;
private Integer maxRating=Integer.valueOf(5);
private Integer maxHandicap = Integer.valueOf(100);//Integer.valueOf(6);
private Integer minHandicap = null;
public MemberName() {
}
public String getFirstname() { return this.firstname; }
public void setFirstname(String name) { this.firstname = name; }
public String getLastname() { return this.lastname; }
public void setLastname(String name) { this.lastname = name; }
public Integer getMaxHandicap() { return this.maxHandicap; }
public void setMaxHandcap(Integer d) { this.maxHandicap = d; }
public Integer getMinHandicap() { return this.minHandicap; }
public void setMinHandcap(Integer d) { this.minHandicap = d; }
public String getGender() { return this.gender;}
public void setGender(String gender) {this.gender = gender;}
public String getDexterity() {return this.dexterity;}
public void setDexterity(String dexterity) {this.dexterity = dexterity;}
public String getMatchPreference() {return this.matchPreference;}
public void setMatchPreference(String matchPreference) {this.matchPreference = matchPreference;}
public String getTournamentEntry() {return this.tournamentEntry;}
public void setTournamentEntry(String tournamentEntry) {this.tournamentEntry = tournamentEntry;}
public Integer getRating() {return this.rating;}
public void setRating(Integer r) {this.rating = r;}
public Integer getMinRating() {return this.minRating;}
public void setMinRating(Integer minR) {this.minRating = minR;}
public Integer getMaxRating() {return this.maxRating;}
public void setMaxRating(Integer maxR) {this.maxRating = maxR;}
public boolean isValidSearch()
{
return (null != this.firstname) ||
(null != this.lastname) ||
(null != this.maxRating) ||
(null != this.minRating)||
(null != this.rating)||
(null != this.gender) ||
(null != this.dexterity) ||
(null != this.matchPreference)||
(null != this.tournamentEntry);
}
@Override
public String toString() {
return "MemberName [firstname=" + firstname + ", lastname="
+ lastname + ", gender=" + gender + ", dexterity="
+ dexterity + ", matchPreference=" + matchPreference
+ ", tournamentEntry=" + tournamentEntry + ", rating="
+ rating + ", minRating=" + minRating + ", maxRating="
+ maxRating + "]";
}
}
我正在使用休眠3从User表中获取数据,该表是一个休眠pojo类-
public List<User> findUsers(Long cityId, String firstName, String
lastName,
String gender, Double rating, Double minRating, Double maxRating,
String dexterity, String matchPreference, String tournamentEntry) {
StringBuilder sb = new StringBuilder();
if (null != cityId) {
sb.append("u.registeredCity.id=").append(cityId).append(" "); //$NON-NLS-1$ //$NON-NLS-2$
}
if (isNotEmpty(firstName)) {
if (sb.length() > 0) {
sb.append("and "); //$NON-NLS-1$
}
sb.append("u.firstName like '").append(firstName).append("%' ");
}
if (isNotEmpty(lastName)) {
if (sb.length() > 0) {
sb.append("and "); //$NON-NLS-1$
}
sb.append("u.lastName like '").append(lastName).append("%'");
}
sb.append(" order by u.firstName, u.lastName");
if (sb.length() > 0) {
sb.insert(0, "where "); //$NON-NLS-1$
}
sb.insert(0, "from User u "); //$NON-NLS-1$
this.log.info("SQL from findUsers method is::"+sb.toString());
return getHibernateTemplate().find(sb.toString());
}