• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Multiple Items to Iterate in on jbctemplate batchupdate.

 
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hello - I have requirement to execute and insert around 2000 records. Hence I choose to execute through jdbctemplate batch template.

Problem: This is to insert insurance plans for my customer. As a requirement I have many Insurances and it has many plans. So getBatchSize() returns number of insurance available and while setting the values i will get Insurance plan object and insert the data. However, with this line getInsuranceList().get(i).getInsPlan(), I get only one plan.

Please advice, If i have to put all this method in a loop to run available insurances so that i can return the size of the plans available. Is this the correct approach to loop the method.

 
Skanda Raman
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Adding below information would give some additional information to help.

Here getInsPlanList size is 10 and however getInsuranceList().size() is 2, I want to iterate and insert the record details of getInsPlanList.size().

So in this case do I need to loop this logic to getInsuranceList().size() so that my getBatchSize() can return of getInsPlanList.size().




 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A batch operation by definition is executing the same SQL statement many times with different parameters. This does not sound like it's the case here. You could do it possibly in 2 batches, but you are only talking about 10 rows I would not even bother with batches.
 
reply
    Bookmark Topic Watch Topic
  • New Topic