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/15 16:10:10 UTC

Problem in batch execution

Hi ,  
 
        I facing a problem regarding 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 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.

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

Notice: 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.   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.  Thank you

Re: Problem in batch execution

Posted by Clinton Begin <cl...@gmail.com>.
Is it just me, or is this the fourth post of this message?  We've responded.

Cheers,
Clinton


On Wed, 15 Dec 2004 20:40:10 +0530, rohit.vohra@tcs.com
<ro...@tcs.com> wrote:
>  
> Hi ,  
>   
>         I facing a problem regarding 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 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. 
> 
>  Rohit Vohra
>  Tata Consultancy Services Limited
>  C - 56, Phase 2
>  Noida,Uttar Pradesh
>  India
>  Mailto: rohit.vohra@tcs.com
>  Website: http://www.tcs.com 
> Notice: 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. 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. Thank
> you
>