hibernate 错误:Provided id of the wrong type for class com.lhaix.pojo.Test. Expected: class java.la
来源:互联网 发布:比特币源码编译成exe 编辑:程序博客网 时间:2024/05/21 10:21
hibernate 错误:Provided id of the wrong type for class com.lhaix.pojo.Test. Expected: class java.la
错误:Provided id of the wrong type for class com.lhaix.pojo.Test. Expected: class java.lang.Long, got class java.lang.Integer
原因是传入的是Integer类型的参数,它需要的是Long类型的参数。
在Hibernate里,只要Number(8)以上的都是用Long类型。
我的代码是:Test test = (Test)session.get(Test.class, 1);
这么写传的是Integer。
应该这么写:Test test = (Test)session.get(Test.class, 1L);
或者:Test test = (Test)session.get(Test.class, (long)1);
等等写法
转自: http://hi.baidu.com/lhaix/item/067d570a2b625adf73e676ea
- hibernate 错误:Provided id of the wrong type for class com.lhaix.pojo.Test. Expected: class java.la
- 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
- Provided id of the wrong type for class
- Debug:Hibernate继承测试的时Provided id of the wrong type for class com.ad91.pdata.bean.PdUsers
- hibernate 中 Provided id of the wrong type for class 异常
- TypeMismatchException: Provided id of the wrong type for class zhongfucheng.user.entity.User.
- int Serializable导致的Provided id of the wrong type. Expected异常
- Exception in thread "main" org.hibernate.TypeMismatchException: Provided id of the wrong type
- No converter found for return value of type: class com.taotao.pojo.TbItem
- The String class is provided in the Java library. Provide your own implementation for the following
- hibernate:newclass.hbm.xml文件错误(the content of element type "class" must match "(meta*,column*,type?generator?...)
- The method newJob(Class<QuartzTest>) is undefined for the type Test
- 错误 Error: Expected resource of type id [ResourceTyp]
- Android打包错误Expected resource of type id...
- Json转对象失败:"No suitable constructor found for type [simple type, class com.test.faster.domain.respons
- Expected resource of type id
- 基于STK的空间态势仿真系统研究
- 2013年下半年百度安徽招聘笔试题
- Eclipse将引用了第三方jar包的Java项目打包成jar文件的两种方法
- OCP-1Z0-053-V12.02-218题
- Action的Result类型
- hibernate 错误:Provided id of the wrong type for class com.lhaix.pojo.Test. Expected: class java.la
- 自定义定时器
- linux给用户添加sudo权限
- 脚本引发的思考
- 2条完全一样的数据删除一条保留一条,用SQL语句删除。
- 基于STK的空间站星载GPS接收机仿真分析
- 用线程实现定时器功能
- 第十周上机实践 求1/3-3/5+5/7-7/9......-19/21
- Maven安装配置及其插件m2e(Eclipse Indigo 和 MyEclipse8.5)的安装配置