This content has been marked as final. Show 4 replies
When the query is running for a long time and you are calling that inside the transaction, the transaction might time out.
In that case you would go for not-supported, so that transaction manager can take the right action when the method
is called inside a transaction. Otherwise it does not really matter.
Is NOT_SUPPORTED faster than REQUIRED?
If then maybe we don't need any transaction in query method?
You can find the steps what the container does for the transaction types here: http://download.oracle.com/javaee/6/api/javax/ejb/TransactionAttributeType.html1 person found this helpful
When you use NOT_SUPPORTED
- If a client calls with a transaction context, the container suspends the association of the transaction context with the current thread
before invoking the enterprise bean's business method. The container resumes the suspended association when the business method has completed.
- In this case the container has to do some processing in suspending and resuming the transaction
When you use REQUIRED
- If the client invokes the enterprise bean's method while the client is not associated with a transaction context, the container automatically starts
a new transaction before delegating a method call to the enterprise bean method.
- In this case the container must start a new transaction
The starting of a new transaction is slower then suspending and resuming the transaction - so you could say that NOT_SUPPORTED is faster than REQUIRED
Thanks a lot.
I'll set SUPPORTS or NOT_SUPPORTS for my EJB method that only do query.