ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jiming Liu" <jiming...@gmail.com>
Subject Fwd: Batch insert using Mysql, id property did not get out
Date Wed, 11 Jul 2007 07:36:07 GMT
---------- Forwarded message ----------
From: Jiming Liu <jimingliu@gmail.com>
Date: Jul 10, 2007 11:47 PM
Subject: Batch insert using Mysql, id property did not get out
To: user-java@ibatis.apache.org

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