第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

java.lang.Long cannot be cast to java.lang.Integer

java.lang.Long cannot be cast to java.lang.Integer

慕運維8079593 2019-03-12 15:15:36
在底層dao自己添加id=1報錯:java.lang.Long cannot be cast to java.lang.Integerid對應的數(shù)據(jù)庫的id,是不是這里定義為long,數(shù)據(jù)庫的id不能用int啊!不知道如何去排查這個錯誤!還發(fā)現(xiàn):數(shù)據(jù)庫都查詢了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=?但是為什么會報錯?已經(jīng)解決,數(shù)據(jù)庫改成bigint,跟long對應,就ok了!
查看完整描述

3 回答

?
躍然一笑

TA貢獻1826條經(jīng)驗 獲得超6個贊

你使用的是什么數(shù)據(jù)庫?
你把參數(shù)(long id)換成(Integer id)。
報這個錯的原因的類型轉換失敗。
long類型無法轉換成Integer類型。

查看完整回答
反對 回復 2019-04-25
?
蠱毒傳說

TA貢獻1895條經(jīng)驗 獲得超3個贊

可以將id在方法里面轉為Integer后在放入dc里面,

String str = id.toString();
Integer id1 = Integer.valueOf(str);
或者Integer id1 = new Integer(str);


查看完整回答
反對 回復 2019-04-25
  • 3 回答
  • 0 關注
  • 5117 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號