Skip to main content

@Schedule and @TransactionAttribute(NEVER) not compatible

2 replies [Last post]
Joined: 2007-07-31


I think that the @TransactionAttribute annotation is not taken into account when there is an @Schedule annotation on the same method (a transaction is created). Am I true? What the correct way of doing?

Thanks for your help,

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2007-07-31

Well the EJB 3.1 spec says:
"18.2.8 Transactions
An enterprise bean typically creates a timer within the scope of a transaction. If the transaction is then rolled back, the timer creation is rolled back.
An enterprise bean typically cancels a timer within a transaction. If the transaction is rolled back, the container rescinds the timer cancellation.
A timeout callback method on a bean with container-managed transactions has transaction attribute REQUIRED or REQUIRES_NEW (Required or RequiresNew if the deployment descriptor is used to specify the transaction attribute). If the container-managed transaction is rolled back, the container retries the timeout."
So, even if I don't understand the reason for this paragraph in the spec, I guess it's normal.

My work-around will be to make the transactions bean managed in the FrontSigleton EJB.

Joined: 2005-04-04

Yes. This is your only option for a non-transactional timeout callback.