Hello,

My environtment is:

Java 1.6
iBatis 2.3.4
Spring 2.5.6
MySQL


I've a method to create records massively (I write directly, it can has
sintax errors; just take the idea):

public List<T> createRecordsMassively(final List<T> records) {

        getSqlMapClientTemplate().execute(new SqlMapClientCallback() {

            public Object doInSqlMapClient(SqlMapExecutor executor) throws
SQLException {
                executor.startBatch();
               
                for (T record : records) {
                        executor.insert("insertRecord", record);
                }
                
                //List<BatchResult> result = executor.executeBatchDetailed();
                int rowsAffected = executor.executeBatch();
                return new Integer(rowsAffected);
            }
        });

        /*Deal with result*/

}

It works well. The problem is: I want to know which records are correctly
inserted and which aren't. I need the Id in order to execute some logic with
each inserted record. ¿What's the way? ¿How can I retrieve the id of the
inserted records?


Thanks in advance,

Westhveg
-- 
View this message in context: 
http://www.nabble.com/Retrieve-inserted-id-in-mass-insert-using-SqlMapExecutor.-tp24406261p24406261.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org

Reply via email to