mambolis
mambolis

Reputation: 323

Using javax.ejb.TransactionAttributeType Annotation in BeanManaged Transactions

I got to review a MessageDriven Bean with following Transactions Annotations:

@TransactionAttribute(TransactionAttributeType.REQUIRED)
@TransactionManagement(TransactionManagementType.BEAN)
public class ODSToBrokerMDB implements MessageListener{

After reading again about Bean Managed Transactions in http://docs.oracle.com/javaee/6/tutorial/doc/bnciy.html I came to the conclusion that the TransactionAttributeType Annotations makes sense only in Container Managed Transactions, although I can't find a Statement in the documentation:

http://docs.oracle.com/javaee/6/api/javax/ejb/TransactionAttributeType.html

Do I oversee something? is javax.ejb.TransactionAttributeType Annotation in BeanManaged Transactions valid?

Upvotes: 1

Views: 675

Answers (1)

Carlitos Way
Carlitos Way

Reputation: 3424

No, @TransactionAttributeannotation is only valid for Container Managed Transaction... in your case, that annotation in your Bean Managed Transaction is only noise...

If you read the associated Javadoc, it says:

The TransactionAttribute annotation specifies whether the container is to invoke a business method within a transaction context. The TransactionAttribute annotation can be used for session beans and message driven beans. It can only be specified if container managed transaction demarcation is used.

Upvotes: 1

Related Questions