TypeMismatchException: Provided id of the wrong type for class zhongfucheng.user.entity.User.
2018-01-21 00:00
1376 查看
今天在使用SSH框架做项目的时候出现了这个错误,找了我非常非常多的时间!!!!!!!
去网上搜也有类似的,一般都是Integer和String匹配不同。。。而我明明要的是String,给了我一个User对象。
原来我在Service层的时候根据id删除记录,我把对象传递过去了。因为我的User对象也实现了Serializable接口!!!!这样就没有报任何错误!!!
原本我只要把id传递过去就行了!!!!!!我传了对象!!!很烦!!!!!
Struts Problem Report Struts has detected an unhandled exception: Messages: 1.Provided id of the wrong type for class zhongfucheng.user.entity.User. Expected: class java.lang.String, got class zhongfucheng.user.entity.User 2.Provided id of the wrong type for class zhongfucheng.user.entity.User. Expected: class java.lang.String, got class zhongfucheng.user.entity.User; nested exception is org.hibernate.TypeMismatchException: Provided id of the wrong type for class zhongfucheng.user.entity.User. Expected: class java.lang.String, got class zhongfucheng.user.entity.User File: org/hibernate/event/def/DefaultLoadEventListener.java Line number: 135
去网上搜也有类似的,一般都是Integer和String匹配不同。。。而我明明要的是String,给了我一个User对象。
Expected: class java.lang.String, got class zhongfucheng.user.entity.User
原来我在Service层的时候根据id删除记录,我把对象传递过去了。因为我的User对象也实现了Serializable接口!!!!这样就没有报任何错误!!!
原本我只要把id传递过去就行了!!!!!!我传了对象!!!很烦!!!!!
相关文章推荐
- TypeMismatchException: Provided id of the wrong type for class zhongfucheng.user.entity.User.
- hibernate.TypeMismatchException: Provided id of the wrong type for class
- org.hibernate.TypeMismatchException: 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
- SSH报错之 Provided id of the wrong type for class model.User. Expected: class java.lang
- hibernate 中 Provided id of the wrong type for class 异常
- Exception in thread "main" org.hibernate.TypeMismatchException: Provided id of the wrong type
- hibernate 错误:Provided id of the wrong type for class com.lhaix.pojo.Test. Expected: class java.la
- Hibernate异常:Provided id of the wrong type for class
- Provided id of the wrong type for class pojo.Books. Expected: class java.lang.Integer, got class java.lang.Long
- Provided id of the wrong type for class
- org.hibernate.WrongClassException: Object with id: 3 was not of the specified subclass
- An EJB Exception:The user-provided class "XXXX" needed by the EnterpriseBean could not be found or loaded.
- java.lang.IllegalArgumentException: No converter found for return value of type:class 解决方案
- java.lang.IllegalArgumentException: No converter found for return value of type: class java.util.Has
- The entity type <type> is not part of the model for the current context
- java.lang.IllegalArgumentException: No converter found for return value of type: class
- java.lang.IllegalArgumentException: No converter found for return value of type: class java.util.Has
- java.lang.IllegalArgumentException: No converter found for return value of type: class java.util.Has
- java.lang.IllegalArgumentException: No converter found for return value of type: class java.util