int Serializable导致的Provided id of the wrong type. Expected异常
来源:互联网 发布:教父 知乎 编辑:程序博客网 时间:2024/04/30 13:26
int类型是不可序列化的,参数传递时,如果传过去后的参数是Serializable,则必须把int型转换为Integer类型如:
public void deleteStation(Integer[] ids) {
try {
stationParDAO.delete(stuIfno.class, ids);
} catch (DAOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
被调用的方法: delete(Class<T> refClass, Serializable[] key)
如果上例中主调方法改为:
public void deleteStation(int[] ids) {
try {
stationParDAO.delete(stuIfno.class, ids);
} catch (DAOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
异常如下:
javax.servlet.ServletException: org.springframework.orm.hibernate3.HibernateSystemException: Provided id of the wrong type. Expected: class java.lang.Integer, got class [I; nested exception is org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.Integer, got class [I
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
root cause
org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.Integer, got class [I org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:86) org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878) org.hibernate.impl.SessionImpl.get(SessionImpl.java:815) org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)- int Serializable导致的Provided id of the wrong type. Expected异常
- hibernate 中 Provided id of the wrong type for class 异常
- hibernate.TypeMismatchException: Provided id of the wrong type for class
- Provided id of the wrong type for class
- Caused by: org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.Integer, got class [Lja
- hibernate 错误:Provided id of the wrong type for class com.lhaix.pojo.Test. Expected: class java.la
- SSH报错之 Provided id of the wrong type for class model.User. Expected: class java.lang
- Debug:Hibernate继承测试的时Provided id of the wrong type for class com.ad91.pdata.bean.PdUsers
- Exception in thread "main" org.hibernate.TypeMismatchException: Provided id of the wrong type
- TypeMismatchException: Provided id of the wrong type for class zhongfucheng.user.entity.User.
- Expected resource of type id
- Error: Expected resource of type id [ResourceType]的解决办法
- 编码解码器无法使用提供的流类型 The codec cannot use the type of stream provided
- Android Studio Error:Error: Expected resource of type id [ResourceType]
- studio 打包 Expected resource of type id [ResourceType]
- 错误 Error: Expected resource of type id [ResourceTyp]
- Android打包错误Expected resource of type id...
- jbpm 异常instance not of expected entity type
- 讨论WebService安全机制的几篇博文
- vim 复制粘贴
- 小糖的糖果
- Lecture 3 (二)
- POJ3714+最近点对
- int Serializable导致的Provided id of the wrong type. Expected异常
- Linux下使用JNI的常见问题及解决方案
- HDU1007+最近点对
- UVA 550 Multiplying by Rotation 数论的规律
- Zend Framework2学习一:介绍
- 黑马程序员----【张孝祥7K面试题】一交通灯管理系统视频学习笔记
- hdu 1010 Tempter of the Bone(dfs+奇偶剪枝)
- 用Visual Studio2010 编译 C++文件"hello world”
- TCP/IP详解学习笔记(1)