I have a Singleton ClassA(container managed transaction) that has methodA annotated @Asynchronous for saving/processing huge set of data to the database.methodA partitions the records and passes to method B annotated as @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) so that it can save and map records in chunks( I say map because the records gets mapped to other tables in sys which takes time) . This was built in the thought that a new transaction for methodB is given by the parent so as to avoid single transaction rollback. Now what is happening while method B is finishing up..methodA(asynch method) timesout. I tried @Accesstimeout(-1) so that it waits until method B completes. but still the error occrs. Do I need to opt Bean managed transaction in this case? or is it still possible with COntainer managed transaction.
0
votes
1 Answers
0
votes
I supose that you have long solved your problem. Anyway I am trying to explain my tought about the possible cause.
As you know, when you call a method B marked as REQUIRES_NEW your current transaction is kept on hold, a new transaction is then assigned to method B execution.
After method B complete its associated transaction is committed and the on hold transaction continues execution.
Now, if you have an iteration call, the original transaction is kept on hold until the loop ends. Have you tried annotating the @Asynchronous method as NOT_SUPPORTED
By the way, I have always found Message Driven Bean far more convenient for this kind of functionality.