今天在使用SSH框架作項目的時候出現了這個錯誤,找了我很是很是多的時間!!!!!!!java
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對象。markdown
Expected: class java.lang.String, got class zhongfucheng.user.entity.User
原來我在Service層的時候根據id刪除記錄,我把對象傳遞過去了。由於個人User對象也實現了Serializable接口!!!!這樣就沒有報任何錯誤!!!app
本來我只要把id傳遞過去就好了!!!!!!我傳了對象!!!很煩!!!!!框架