java.lang.Long cannot be cast to java.lang.Integer 财富值55

2016-10-18 10:42发布

在底层dao自己添加id=1

报错:java.lang.Long cannot be cast to java.lang.Integer
id对应的数据库的id,是不是这里定义为long,数据库的id不能用int啊!
不知道如何去排查这个错误!

还发现:数据库都查询了

DetachableCriteria(CriteriaImpl(com.pdcss.dbzx.survey.entity.SurveyProblems:this[][id=1])) Hibernate: select this_.id as id1_10_0_, this_.analysis as analysis2_10_0_, this_.answer as answer3_10_0_, this_.bank_id as bank_id4_10_0_, this_.createtime as createti5_10_0_, this_.img as img6_10_0_, this_.problem_name as problem_7_10_0_, this_.type as type8_10_0_, this_.typeStr as typeStr9_10_0_ from survey_problems this_ where this_.id=? 

但是为什么会报错?

已经解决,数据库改成bigint,跟long对应,就ok了!

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
3条回答

可以将id在方法里面转为Integer后在放入dc里面,

一周热门 更多>