Problem in Transaction context switching/propagation

Discussions

EJB programming & troubleshooting: Problem in Transaction context switching/propagation

  1. SessionBean A @NotSupported methodA Calls methodB Calls methodC @Required methodB Calls EntityBeanA findByPrimaryKey method @Mandatory SessionBean B @Required methodC Explanation why such transaction demarcation is needed. SessionBean A is basically for running batches . idea is if batch processes 1000 transactions and after 600 successful 601 faisl then whole batch should not be rollback. So each call on method C runs in a separate transaction. Finaaly we check the batch success count , error count and compare it with the prcoess count . I am getting error TransactionRequiredException while accessing EntityBean A . I am guessing its problem in jboss server the TransactionContext is not propagating properly from NotSupported to Required and then back to NotSupported . Please do let me know if anybody face such problem. I am using JBoss 3.2.4 as application server. Mohit
  2. I don't want to question why you are using entity beans for a batch process..-)) suggested - session Bean - direct jdbc.... in case you want to stick to entity bean for batch to avoid data stomping which might happen while batch process is running... i am assuming you are querying entity bean A by primary key.. you don't require transaction attribute on entity bean's method...i am tempted to recommend...[assuming your isolation level is set correctly...]
  3. Correct propagation declaration should be: @Required methodA @RequiresNew methodB & methodC Alternatively (if you need to call methodB and C atomically in combination), @RequiresNew methodD calls methodB & C that are declared as @Required. Declaring methods with NotSupported is not applicable in most EJB containers. The functionality is not properly defined. /Niklas
  4. yeah you are correct by applying these transaction demarcations it works but what surprises me that jboss doesn't support the earlier transaction propagation from NotSupported. anyway thanks very much for all in replying. Mohit