首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

Hibernate的getHibernateTemplate().delete(Object object)报类型转换异常

2014-01-26 
对象代码:public class BankRemitInfo extends AbstractBankremitinfo implements java.io.Serializable {/

对象代码:
 
  public class BankRemitInfo extends AbstractBankremitinfo implements java.io.Serializable {
 
  // Constructors
 
  /** default constructor */
  public BankRemitInfo() {
  }
 
  /** minimal constructor */
  public BankRemitInfo(String datatype, long datatorder) {
  super(datatype, datatorder);
  }
 
  /** full constructor */
  public BankRemitInfo(String datatype, String name1, double bnby1, double bnlj1, String name2, double bnby2, double bnlj2, long datatorder) {
  super(datatype, name1, bnby1, bnlj1, name2, bnby2, bnlj2, datatorder);
  }
  public String toString() {
  return new ToStringBuilder(this)
  .append("id", getId())
  .toString();
  }
 
  public boolean equals(Object other) {
  if ( !(other instanceof BankRemitInfo) ) return false;
  BankRemitInfo castOther = (BankRemitInfo) other;
  return new EqualsBuilder()
  .append(this.getId(), castOther.getId())
  .isEquals();
  }
 
  public int hashCode() {
  return new HashCodeBuilder()
  .append(getId())
  .toHashCode();
  }
 
 
  }
 
  调用
  BankRemitInfo aaa=(BankRemitInfo)resultList.get(i);
  getHibernateTemplate().delete(object);
  出现以下异常
  java.lang.ClassCastException: cn.com.opendata.hyxxk.model.impl.BankRemitInfo
  at org.hibernate.type.StringType.toString(StringType.java:44)
  at org.hibernate.type.NullableType.toLoggableString(NullableType.java:16
  9)
  at org.hibernate.pretty.MessageHelper.infoString(MessageHelper.java:68)
  at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultL
  oadEventListener.java:153)
  at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEv
  entListener.java:87)
  at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:891)
  at org.hibernate.impl.SessionImpl.get(SessionImpl.java:828)         

热点排行