Hi guys,
There have an id, which is auto_increment filed in table city of a mysql db
.
The insert("insertCity", v); method works correct, since it works fine in
non-batch mode.
But in the following batch code. All the id is 0, which is initilized by -1.
That means iBatis do set the value but do not know the right value. What
shall I do to get the value?
Best regards,
Jiming
public Object insert(int mender_id, final List<City> value, final
boolean use_current_time) {
return template.execute(new SqlMapClientCallback() {
public Object doInSqlMapClient(SqlMapExecutor executor) throws
SQLException {
executor.startBatch();
for(City v: value) {
executor.insert("insertCity", v);
}
List result = null;
try {
result = executor.executeBatchDetailed();
} catch (BatchException e) {
throw ex;
}
return result;
}
});
}