您的位置:首页 > 编程语言 > Java开发

Caused by: org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.Integer, got class [Lja

2008-05-22 13:57 781 查看
在作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)

方法而传了一个数组进来
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐