ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jiming Liu" <jiming...@gmail.com>
Subject Batch insert using Mysql, id property did not get out
Date Tue, 10 Jul 2007 15:47:48 GMT
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,


    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 {
                for(City v: value) {
                    executor.insert("insertCity", v);
                List result = null;
                try {
                    result = executor.executeBatchDetailed();
                } catch (BatchException e) {
                    throw ex;
                return result;

View raw message