• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is this EJB 3 bulk insert/persist or this will reduce the network traffic?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am new to EJB 3.0 , I am working on project which involves more than one insert ( entity-manager persists ) for child records.

I know batch update ,I tried for batch inserts using following method. After reading more about flush ie If the flush mode is set to COMMIT, the persistence provider will
only synchronize with the database when the transaction commits
.

So, after for following code there will be only one call from ejb container to sql server for n inserts, this will also reduce the network traffic too.
Please let me know your comments.




 
author
Posts: 304
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all, flushmode COMMIT is really more of a hint that the provider should not flush until commit, there are no guarantees.
Second, setting the flushmode is not going to guarantee that you are going to get a single trip to the database. Once flushing occurs (for example at commit time) then there may be any number of database trips occurring, depending upon what the provider needs to do, and I highly doubt any provider would actually batch multiple persist calls of the same object type into a single SQL statement.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic