• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Want to persist 100 @Entity objects during the same @Transaction

 
Ravi Danum
Ranch Hand
Posts: 154
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello,

I am loading our database; I receive the data via SOAP messages. I have @Entity classes created for each table, and want to persist 100 or so records in a table in one transaction.

I'm using Spring, and at first wanted to use the CrudRepository to store the records one at a time. This is too slow.

Can anyone suggest another way using the @Entity classes, and @Transaction to store 100 entities during a single transaction?

I will call this from an @Service class.

Many thanks and I look forward to hearing back.

Ravi
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This article might be helpful as it illustrates how to use JPA batch inserts with Hibernate & Spring Data.

Hope it helps!
Kind regards,
Roel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic