Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate multiple records update in a single statement

 
somu sharma
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have table and want to update each Salary record for each ID

ID FirstName Salary
10 AAAA 10,000
15 BBBB 5000
17 CCCC 7000
19 DDDD 8000

But what happening is update statement is executed for each row.Suppose I have 1000 records then update statement is executing 1000 times.Is there any better way I can achive this.
I am doing as ,

Is there way i can optimize this code ?

Thanks
 
Piyush Mangal
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try using hql if you want to update all the records at once.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic