出现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. 用JS改变的元素CSS样式,css里display :none 隐藏 block 显示

    CSS样式的引用有3种方式:style引用.class引用.id引用,所以js改变元素的样式我们也分3种来说. 1.js改变由style方式引用的样式:方法一:document.divs.style. ...

  2. Delphi中的dll操作

    利用delphi dll wizard进行dll的编写. 创建:保存时改dll名称 library test2; uses SysUtils, Classes, forms, dialogs; {$R ...

  3. 正确使用索引(sql优化),limit分页优化,执行计划,慢日志查询

    查看表相关命令 - 查看表结构   desc 表名- 查看生成表的SQL   show create table 表名- 查看索引   show index from  表名 使用索引和不使用索引 由 ...

  4. 斯坦福大学Andrew Ng - 机器学习笔记(5) -- 支持向量机(SVM)

    大概用了一个月,Andrew Ng老师的机器学习视频断断续续看完了,以下是个人学习笔记,入门级别,权当总结.笔记难免有遗漏和误解,欢迎讨论. 鸣谢:中国海洋大学黄海广博士提供课程视频和个人笔记,在此深 ...

  5. 通过存储过程运行通过DBLINK的查询语句失败-单个语句成功--ORA-00604

    版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/q947817003/article/details/24419459 客户遇到个问题,描写叙述例如以 ...

  6. Linux 使用pppd和ppp程序进行3G/4G拨号

    试验环境:Linux marsboard 3.4.90 #9 SMP PREEMPT Thu Mar 3 18:28:43 CST 2016 armv7l armv7l armv7l GNU/Linu ...

  7. 常用MS-SQL写法整理

    这里整理日常会用到的一些写法,一些常规的group by,系统函数等用法不在这里做记录了,大家有什么好的写法也可以分享下 1 sql操作xml内容(sp_xml_preparedocument和ope ...

  8. Shell Step by Step

    @1:Command: ctrl+z  ------->切后台 fg ------->切前台 Ctrl + a :移到命令行首 Ctrl + e :移到命令行尾 Ctrl + u :从光标 ...

  9. golang模板语法简明教程(后面有福利哦)

    template是go 语言web开发中必不可少的,特此记录下来: [模板标签] 模板标签用"{{"和"}}"括起来   [注释] {{/* a comment ...

  10. 备注字段长度控制JS

    //变更原因备注字符长度控制 function checkChangeLength() { var field = $("#changeReasonDesc").val(); ma ...