Meaningless Drivel is fun!
The moose likes Spring and the fly likes Batch insert and update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Batch insert and update" Watch "Batch insert and update" New topic

Batch insert and update

Pratik Parekh

Joined: Jun 09, 2011
Posts: 21

Hello Everyone,
Following is my code which I want to convert in batch insert and update with the mentioned scenario.

Integer updateCount=jdbcTemplate.update("update qt_ew set ew_ask = ?," +
"time_stamp = ? where subscription_code = ?",
new Object[] {ConverterUtil.round(quoteEvent.getPrice(), RoundingMode.HALF_UP),
if(updateCount.intValue()==0) {
Integer insertCount=jdbcTemplate.update("insert into qt_ew(subscription_code,ew_ask,time_stamp) " +
"values(?,?,?)",new Object[] {quote.getSubscriptionCode(),
ConverterUtil.round(quote.getPrice(), RoundingMode.HALF_UP),quote.getTradeTime()});

Please help me to fulfill my requirement.
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 607

well I can't read the code (hint: use Code tag) and I can't figure out your mentioned scenario (hint: describe it)

Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
Consider Paul's rocket mass heater.
subject: Batch insert and update
jQuery in Action, 3rd edition