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

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

自己在后臺拼湊一個userModel,但是數(shù)據(jù)插入失敗

https://img1.sycdn.imooc.com//5c4583eb0001115809600618.jpg

上面是拼湊好的userModel,傳給userServiceImpl,執(zhí)行到下面這一步就。。。。

https://img1.sycdn.imooc.com//5c4585a400015c0a05200056.jpg

報錯如下:

=======================================================================

2019-01-21 16:32:45.673? WARN 13744 --- [nio-8080-exec-2] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.jdbc.BadSqlGrammarException:?

### Error updating database.? Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

### The error may involve com.miaoshaproject.dao.UserDOMapper.insertSelective-Inline

### The error occurred while setting parameters

### SQL: insert into user_info

### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]

=======================================================================

這報錯什么鬼?我是誰?我在哪里?我要不要找UserDOMapper.insertSelective喝喝茶?

正在回答

1 回答

解決了,就是下面標(biāo)黑的兩個變量調(diào)換了,弄得userDO里的變量都為null,在寫入mysql時報錯如題所示

//?實現(xiàn)userModel->user?data?object方法
private?UserDO?convertFromUserModel(UserModel?userModel)?{
????if?(userModel?==?null)?{
????????return?null;
????}

????UserDO?userDO?=?new?UserDO();
????//?將userModel的屬性賦予給userDO
????BeanUtils.copyProperties();
????return?userDO;
}


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

斯基姆斯 提問者

BeanUtils.copyProperties(userModel, userDO);
2019-01-21 回復(fù) 有任何疑惑可以回復(fù)我~
#2

慕的地3081565

題主,怎么解決的呀w,我這還是不行
2019-03-16 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

自己在后臺拼湊一個userModel,但是數(shù)據(jù)插入失敗

我要回答 關(guān)注問題
微信客服

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

幫助反饋 APP下載

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

公眾號

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