You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by ro...@tcs.com on 2004/12/14 11:07:10 UTC

Problem while executing a batch

Hi,  
 
        I facing a problem during the execution of Batch. I'm not able to 
get the number of rows updated when the batch is executed. 
        I'm currently using IBatis version 2.0.3. 
        I'm doing the following :  

        startTransaction() 
                startBatch() 
                        insert... 
                        update... 
        int rows = executeBatch() 
        commitTransaction() 
        endTransaction


                I'm getting number of rows updated = 0. But the statements 
included in the batch get executed properly.

                   When I looked into the iBatis code, I found that when 
the preparedStatement.executeBatch() is being called in the private Batch 
class 
                contained in SqlExecuter, and in executeBatch method of 
this private class, following line : 
 
                        int[] rowCounts = ps.executeBatch(); 
 
                All the int array elements contain -2, which means Success 
but No. of rows updated unknown. It's not returning the number of rows 
                updated. 
 
        I looked for it on internet, and found the following something 
similar : 
                        
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=3&t=004071
 
 
        Am not able to make how to get the number of rows updated, which 
is needed in the scenario I'm working in.

        Please help for the same.


Regards,

Rohit Vohra
Tata Consultancy Services Limited
C - 56, Phase 2
Noida,Uttar Pradesh
India
Mailto: rohit.vohra@tcs.com
Website: http://www.tcs.com

DISCLAIMER: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information.   If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited and any violation thereof would possibly attract penal action.   If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. TCS accepts no liability for any damage caused by this email or its attachments due to viruses, interference, interception, corruption or unauthorized access/use.