zoukankan      html  css  js  c++  java
  • TypeMismatchException: Provided id of the wrong type for class zhongfucheng.user.entity.User.

    今天在使用SSH框架做项目的时候出现了这个错误,找了我非常非常多的时间!!!!!!!

    
    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传递过去就行了!!!!!!我传了对象!!!很烦!!!!!

  • 相关阅读:
    java优雅的使用elasticsearch api
    springboot mybatis优雅的添加多数据源
    java通过shield链接Elasticsearch
    java spark-streaming接收TCP/Kafka数据
    hiveQL求差集
    hiveQL去重
    Ubuntu16.04+Opencv3.3的安装教程
    TensorFlow池化层-函数
    TensorFlow激活函数+归一化-函数
    TensorFlow图像预处理-函数
  • 原文地址:https://www.cnblogs.com/zhong-fucheng/p/7202928.html
Copyright © 2011-2022 走看看