• 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

Timeout in Entity Bean

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

I am entering around 1,000 records in a Database and this insertion is done through and entity beans. As it is an existing System we are not using JMS instead we get around 1000 records in Session bean and from Session bean I am calling and Entity Bean Create method.

The Problem I am facing is after around 200 insertions, The timeout exception comes at the Server.

What I wanted to know is what may be the problem behind this and is there any workaround for this. Also is this something related to timeout setting in Application Server. and yeah if that is the reason I don't have access to change the timeout settings of the WAS(Websphere Application Server)

let me know if you have any suggestions or comments on this asap.

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

We have a similar scenario. The number of records to be processed at a time range from 1 to few hundreds. In your case waiting for 1000 records to be inserted before container invokes commit is too long time(connection holding time) and it may not scale. Here is just a suggestion/workaround(It may not suit you, but still can take a look)

SessionBean:
-->processData() (no transaction){
------->List storeList = retrieveAllTheRecordsToBeStored();(Tx:Requires new)
-------> int batchSize =100;
------->for (int i =0; i < storeList.size(); i =i+batchSize) {
-----------> persistData(storeList.subList(i,batchSize ));
-------> }
-->}

//The folowing method commit every sublist size of records
-->persistData(List subList) (Tx:Requires new){
------->for (int i =0; i < subList.size(); i++) {
-----------> createCMP((SomeObject)subList.get(i));
-------> }
-->}

This way you can still store all the records with more control.

Thanks
 
Rahul Juneja
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Raj,

Will just set the transaction attributes in this manner and hope this will help.

Cheers,
Rahul
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As you are dealing with large amounts of data, have you considered using JDBC directly from your session bean rather than using entity beans.
 
Rahul Juneja
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Roger,

Thanks dude for your suggestion, but the problem is that this is a large existing System which is using Entity beans and I can't make large changes to the system.

Any more suggestion.

Cheers,
Rahul
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post your code so that we can assess if there are any performance issues which can be addressed.
 
reply
    Bookmark Topic Watch Topic
  • New Topic