Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) 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)
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!