Bug 1466909

Summary: TransactionAttribute annotation is inherited from interface which not according to the spec
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: wfink
Component: EJBAssignee: Radovan STANCEL <rstancel>
Status: CLOSED EOL QA Contact: Pavel Slavicek <pslavice>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4.14CC: david.lloyd, rstancel
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-19 12:44:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description wfink 2017-06-30 17:31:09 UTC
Description of problem:


The annotation @TransactionAttribute is inherited from the business interface which is not according to the EJB specification.
Any annotation on the bean's implemenation class or deployment descriptor is overridden if the Interface is annotated with @TransactionAttribute

The EJB 3.2 specification chapter 8.3.7 says
"For a session bean written to the EJB 3.x client view API, the transaction attributes are speci-
fied for those methods of the session bean class that correspond to the bean’s business inter-
face"
Also the Javadoc for TransactionAttribute (http://docs.oracle.com/javaee/7/api/javax/ejb/TransactionAttribute.html) mention the bean class only.



How reproducible:


Simple Bean implementation

@Stateless
public class AnnotatedTxBean implements AnnotatedTx {
private static final Logger log = Logger.getLogger(AnnotatedTxBean.class);
@Resource
SessionContext context;

@TransactionAttribute(TransactionAttributeType.REQUIRED) // this is also the default
public void checkRollbackForDefaultRequired()
{ log.info("Now checking rollback"); log.info("RollbackOnly is '" + context.getRollbackOnly() + "'"); }

}

Interface:
public interface AnnotatedTx
{ @TransactionAttribute(TransactionAttributeType.NEVER) void checkRollbackForDefaultRequired(); }

The invocation will fail with:
ERROR [org.jboss.as.ejb3.invocation] (EJB default - 1) JBAS014134: EJB Invocation failed on component AnnotatedTxBean for method public abstract void org.jboss.wfink.ejb31.timer.AnnotatedTx.checkRollbackForDefaultRequired(): javax.ejb.EJBException: JBAS014163: Transaction present on server in Never call (EJB3 13.6.2.6)

and work if the annotation on interface level is removed

Comment 1 Radovan STANCEL 2017-08-21 10:29:06 UTC
PR: https://github.com/jbossas/jboss-eap/pull/3045