• 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

entity bean writes many records

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

I am trying to write into the database many records (say >1000) using entity beans.
The problem is when the user hits the submit button for this processing, he has to wait for a long time till the long process completes and is forwarded to the next page on success.
Sometimes, the user may think that the page is doing nothing and hit the submit button twice due to the delay.

Is there a way, that I cud put this process (writing 1000 records) in a queue and return to the next page so the user sees the next page soon and the writing to database takes place in the back?

Thanks
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You just answered your own question. Just send a JMS message and use a MDB to put the records into the DB. But be aware that the client does not know if the operation succeeded or not.
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Given that you posted this in the EJB forum, presumably these database interactions are somehow implemented in EJB, e.g. entity beans. If so, another thing to take a look at are the vendor-specific deployment descriptor options that control how your database changes are actually processed during and at the end of the transaction. Sometimes you can get a very significant speedup by ensuring that all the writes happen just on the transaction commit. Particularly in WebLogic and I believe also in the most recent JBoss 3.2.x and 4.0.x releases, you can see very big differences in CMP performance because the container can sometimes switch to using SQL batching.

The JMS approach works ok too, but only if you aren't expecting to forward the user to a page that reflects the committed results. Obviously those won't always be available if the changes are off processing in some other thread of execution.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic