Today I would like to share my experience about the EJB TransactionAttributeType “REQUIRES_NEW”. The goal of this attribute is to isolate a method from the current transaction context and run the code in a new separate transaction. The transaction attribute can simply be annotated to a method:
@TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW) public void processSingleWorkitem(ItemCollection aWorkitem) { workflowService.processWorkItem(aWorkitem); }
But this annotation can become a little bit tricky if you need such a construction in a single EJB. Continue reading “EJB 3.0 and the TransactionAttributeType REQUIRES_NEW”