出现org.hibernate.TypeMismatchException: Provided id of the wrong type for class cn.itcast.entity.User. Expected: class java.lang.String, got class java.lang.Integer at org.hibernate.event.internal.DefaultLoadEventListener.checkIdClass(DefaultLoadEventListen

这样的错误,可能是bean中的数据类型和hbm.xml中指定的主键生成策略不一致。

比如我在bean中,将uid写出字符串,而在hbm.xml中使用的是<generator class="native"/>这样就报错了。

org.hibernate.TypeMismatchException: Provided id of the wrong type for class cn.itcast.entity.User. Expected: class java.lang.String, got class java.lang.Integer at org.hibernate.event.internal.Defau的更多相关文章

  1. TypeMismatchException: Provided id of the wrong type for class zhongfucheng.user.entity.User.

    今天在使用SSH框架做项目的时候出现了这个错误,找了我非常非常多的时间!!!!!!! Struts Problem Report Struts has detected an unhandled ex ...

  2. org.hibernate.TypeMismatchException: Provided id of the wrong type for class *** Expected ***

    今天上生产发现warn日志有异常,就查看了下: 2018-12-05 10:05:05.666 [pool-4-thread-1] ERROR org.springframework.batch.co ...

  3. Provided id of the wrong type for class pojo.Books. Expected: class java.lang.Integer, got class java.lang.Long

    log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please ...

  4. 报错HTTP Status 500 - HHH000142: Javassist Enhancement failed: cn.itcast.entity.Customer; nested exception is org.hibernate.HibernateException: HHH000142: Javassist Enhancement failed: cn.itcast.entity.

    报错 type Exception report message HHH000142: Javassist Enhancement failed: cn.itcast.entity.Customer; ...

  5. 报错HTTP Status 500 - The given object has a null identifier: cn.itcast.entity.Customer; nested exception is org.hibernate.TransientObjectException: The given object has a null identifier:

    在使用模型驱动封装的时候,要保证表单中name属性名和类中属性名一致,否则将会报错如下: HTTP Status 500 - The given object has a null identifie ...

  6. 报错:org.hibernate.AssertionFailure: null id in com.tt.hibernate.entities.News entry (don't flush the Session after an exception occurs)

    在使用hibernate创建数据库的表格时,出现了如下报错: 十二月 28, 2016 10:17:02 上午 org.hibernate.tool.hbm2ddl.SchemaExport perf ...

  7. Hibernate注解映射sequence时出现无序增长问题+hibernate 映射 oracle ID自动增长:

    Hibernate注解映射sequence时出现无序增长问题+hibernate 映射 oracle ID自动增长: 通过Hibernate注解的方式映射oracel数据库的sequence主键生成器 ...

  8. org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.String

    org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.Strin ...

  9. org.hibernate.AssertionFailure: null id in xxx.xx.xx的问题

    今日在开发时遇到一个比较奇怪的问题,保存时报这个异常: org.hibernate.AssertionFailure: null id in com.aa.TShoucang null id,这个是什 ...

随机推荐

  1. CSS如何清除浮动流的多种方案

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. centos系统时间相差8个小时解决方案

    查看当前系统时间 [root@centos64 ~]# date 查看硬件时间 [root@centos64 ~]# hwclock --show 同步时间可以用:ntpdate us.pool.nt ...

  3. 我的Android进阶之旅------>RGB颜色查询对照表

    因为兼容性问题,色阶板功能只能在IE浏览器中运行 RGB颜色对照表   #FFFFFF   #FFFFF0   #FFFFE0   #FFFF00   #FFFAFA   #FFFAF0   #FFF ...

  4. Linux安装配置

    虚拟机配置Linux镜像文件 配置网路 防火墙 一.虚拟机配置Linux镜像文件 1.将下载好的Linux镜像文件载入进来 2.启动虚拟机,安装 3.此步为是否检测linux系统,我们选择" ...

  5. Android-自己定义meta-data扩展数据

    版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/wwj_748/article/details/25079991 Android-自己定义meta-d ...

  6. studio显示Surface: getSlotFromBufferLocked: unknown buffer: 0xa2a58be0

    根据查询外网资料来看,出现这个错误的原因大致是换个模拟器或者物理机就可以了. 因为我使用的是安卓6.0,貌似都会出现这类的问题. 但是不影响程序运行.

  7. sublime使用心得

    1.ctrl + shift +p 命令面板 ---> toggle_side_bar 2.ctrl + shift +p 命令面板 --->reindent lines 3.ctrl + ...

  8. scrapy使用笔记

    新建项目 在需要新建项目的目录下发指令 scrapy startproject MySpider 其中MySpider为工程的名字,会新建一个文件夹 进入工程目录 新建一个爬虫 scrapy gens ...

  9. javascript语言基础知识

    一.JavaScript语法的引入方式. 1.直接引入(在html的head中直接引入js语法) <script> js语法 </script> 2.导入文件(以导入文件的方式 ...

  10. mysq数据库的安装和基本操作

    一.数据库的简介 1.什么是数据库? 数据库(database,DB)是指长期存储在计算机内的,有组织,可共享的数据的集合.数据库中的数据按一定的数学模型组织.描述和存储,具有较小的冗余,较高的数据独 ...