在作hibernate的删除时使用了方法
com.sitechasia.webx.core.dao.hibernate3.BaseHibernateDomainDao#deleteByIds(java.io.Serializable[])
进行删除时出现了如下怪异的异常:
testDeleteByIds(com.sitechasia.webx.core.dao.hibernate3.BaseHibernateDomainDaoTest)
org.springframework.orm.hibernate3.HibernateSystemException: Provided id of the wrong type. Expected: class java.lang.Integer, got class [Ljava.io.Serializable;; nested exception is org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.Integer, got class [Ljava.io.Serializable;
Caused by: org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.Integer, got class [Ljava.io.Serializable;
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:84)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
at org.springframework.orm.hibernate3.HibernateTemplate$1.doInHib
解决方法如下:
1.首先检查传参类型是否正确.
2.再检查方法是否正确,我就是因为使用了
com.sitechasia.webx.core.dao.hibernate3.BaseHibernateDomainDao#deleteById(java.io.Serializable)
方法而传了一个数组进来