[jboss-user] [EJB/JBoss] - Suggestion for transaction configuration on stateful session

vettori do-not-reply at jboss.com
Mon May 18 03:00:11 EDT 2009


Hi,

I'm using jboss 4.2.3. I use a stateful session bean to perform a long and complex operation on the entities that can require a lot of database accesses and other operations for each entity.

The stateful session bean has a few methods to setup the operation: one is to select the set of entities to process, one is to set the number of "batches" and one to set the "batch" size.

Then there's a method that when called performs the operation on a subset of the specified size of the selected entities. This method uses flush and clear method of the entity manager to flush changes to disk. This method is called from the client once for each "batch".

This bean is called from a java app, a sort of batch app that runs once a week. It simply select the number of batches and their size and then it calls the main method of the bean with a for loop.

The entire job on my actual data set runs for about 40 minutes.
At the end of the process I get an exception, a transaction timeout.
Now I suspect that using the standard transaction configuration, the transaction starts when the batch app calls the first bean method and it ends when the app destroy the bean. Since the actual jboss tx timeout is set to 600 seconds this makes the session bean timeout.

What's the best transaction configuration for the bean ? Should I set all "setup" methods to Never and the main method of the bean to requires new ? Or should I set all to Never ? Any other hint ?

Thank you for your help.



View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4231521#4231521

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4231521



More information about the jboss-user mailing list