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.
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 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.