permaculture playing cards
The moose likes Beginning Java and the fly likes Counting .executeBatch(); Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Counting .executeBatch();" Watch "Counting .executeBatch();" New topic
Author

Counting .executeBatch();

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 744
How can I count the inserted records


[ April 11, 2008: Message edited by: Fred Rosenberger ]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 41084
    
  29
. . . by adding count++; as a line in your for-loop?
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 744
Originally posted by Campbell Ritchie:
. . . by adding count++; as a line in your for-loop?


Thanks a lot
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19908
    
  23

Or look at the return value of executeBatch. That's an int[]:
an array of update counts containing one element for each command in the batch. The elements of the array are ordered according to the order in which commands were added to the batch.

Just add those values and you should get the answer as well.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Counting .executeBatch();