An annotated TransactionAttributeType is not applied to a inherited EJB-Method

Solution Verified - Updated -

Issue

There seems to be a bug impacting the EJB configuration via annotations.
Two different SessionEJBs BeanA and BeanB with the following annotations defined at class level

   @TransactionManagement(TransactionManagementType.CONTAINER) 
   @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) 

BeanB inherits methods from its superclass but does not override any of them

Code Snippet

------------------
BeanA.java
------------------
@Stateless(name="BeanA")
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public class BeanA implements BeanARemoteInterface {

        @Override
        public void testMethod() throws Exception {
           .. .. ..
        }
-------------------
BeanB.java
-------------------
@Stateless(name="BeanB")
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public class BeanB extends SimpleBaseClass implements BeanBLocalInterface  {
        //All functionality is defined in SimpleBaseClass!      
}
-------------------

public class SimpleBaseClass  {
        public void testMethod() throws Exception {             
                .. .. ..
        }
  • A remote call invokes BeanA#testMethod() and and subsequently BeanA#testMethod() invokes BeanB#testMethod() (which is inherited from the superclass SimpleBaseClass)

Although BeanB requires a new transaction, the BeanB#testMethod() is executed within the same transaction.
This buggy behaviour occurs only if the TransactionAttributeType is set via annotation. If the trans-attribute is set via ejb-jar.xml, then both EJBs are operating as expected in two different transactions.

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 6.4.x
    • EJB 3.1
    • EJB BeanB inherits methods from a superclass SimpleBaseClass
    • There are no annotations in the superclass of the BeanB SimpleBaseClass
    • BeanB does not override any of the inherited methods from superclass SimpleBaseClass
    • BeanB has the following annotations defined at class level
      • @TransactionManagement(TransactionManagementType.CONTAINER)
      • @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content