Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Batch insert and update

 
Pratik Parekh
Greenhorn
Posts: 21
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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),
quote.getTradeTime(),quote.getSubscriptionCode()});
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
Posts: 607
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well I can't read the code (hint: use Code tag) and I can't figure out your mentioned scenario (hint: describe it)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic