This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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 REST with Spring (video course) this week in the Spring 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
I agree. Here's the link:
subject: Batch insert and update
It's not a secret anymore!