File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
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: 1372
Which is the optimized way for bulk insert using EJB 3 ?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30353
    
150

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: 1372
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://aspose.com/file-tools
 
subject: EJB3 -> Best optimizzed way for bulk insert ?