2017-12-12 15:35
保存集合的sql打印:
insert into `record`(`low_hypertension`, `high_hypertension`, `device_id`, `user_id`, `steps_num`, `heart_rate`, `state`, `raw_data`, `record_time`, `oxygen`) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
for循环保存的sql打印:
Sql: insert into `record`(`low_hypertension`, `high_hypertension`, `device_id`, `user_id`, `steps_num`, `heart_rate`, `state`, `raw_data`, `record_time`, `oxygen`) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Sql: insert into `record`(`low_hypertension`, `high_hypertension`, `consum_time`, `device_id`, `user_id`, `steps_num`, `heart_rate`, `state`, `raw_data`, `record_time`, `oxygen`) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
初步认为,保存集合的时候,是根据第一个元素来生成插入sql的,但是我第一个元素的Long类型的字段是没有数据的,是null,导致没有将该字段生成到sql语句当中