Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to use JPA to save a list of objects

 
Raj Ohadi
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
new to jpa. if I have a table CUSTOMER (NAME, ADDRESS, PHONE) and I have a list of <Customer> object which has the values for these 3 columns. What's the easiest way to insert the List inot table ?
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
 
Raj Ohadi
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hebert Coelho wrote:Iterate over it and persist each one.


isn't a simpler way (java jpa syntax wise) to persist the entire list at once ?
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raj Ohadi wrote:
Hebert Coelho wrote:Iterate over it and persist each one.


isn't a simpler way (java jpa syntax wise) to persist the entire list at once ?


Never heard of it.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!