java - mybatis 插入数据到oracle,id无法用selectkey获取到数据
阿神
阿神 2017-04-18 10:50:29
0
1
392


如图,所示,id判断是不是null的时候,竟然认为id=null,结果sql语句就变成
INSERT INTO core_tzt_product ( product_name, product_type, product_price, crasr_code, period_days, buy_type, start_date, end_date ) values ( ?, ?, ?, ?, ?, ?, ?, ? ) ,
但是如果我把id判断是不是null的if去掉,则可以新增成功。代码如下


,有点搞不清楚,这是mybatis的bug吗,还是我哪里有弄错

阿神
阿神

闭关修行中......

reply all(1)
刘奇

SelectKey needs to pay attention to the order attribute. In databases like MySQL that support automatic growth, order needs to be set to after to get the correct value.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!