aspose file tools
The moose likes EJB and other Java EE Technologies and the fly likes EJB3 -> Best optimizzed way for bulk insert ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "EJB3 -> Best optimizzed way for bulk insert ?" Watch "EJB3 -> Best optimizzed way for bulk insert ?" New topic
Author

EJB3 -> Best optimizzed way for bulk insert ?

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1300
Which is the optimized way for bulk insert using EJB 3 ?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26173
    
  66

Do youhave to use JPA (EJB 3)? I would use a batchupdate in direct JDBC for large batches of inserts. Or a direct SQL loader for still larger batches.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1300
I have to use JPA (EJB 3)
Ran Pleasant
Ranch Hand

Joined: Jan 16, 2003
Posts: 75
kri shan wrote:I have to use JPA (EJB 3)


If you need to insert a large number of objects of dis-associated objects then you might follow the advice you have already in earlier posts.

On the other hand, if you need to insert a large number of associated (aggregated) objects, such as invoices with their line items and their line item details, then you might design the objects with cascading insert and update. This would allow you to save many records by saving a root object, in the example above saving an invoice object would also save all of its children and their children. This is much faster than looping through the objects and saving them individually.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: EJB3 -> Best optimizzed way for bulk insert ?
 
Similar Threads
Million record upload and diplay with pagination
Bad Performance for JDBC Insert
Best way to insert 10000 rows in JDBC
Scrabble... it only takes a minute...
Bulk Insert in JPA 2