Thursday, January 31, 2013

[CODE] Setting the transaction timeout in EJB 3 using annotations

It's annoyingly hard to find this info online, so here it is:

The timeout annotation is provider specific (weblogic, jboss, etc.).  For example, for Weblogic it is @TransactionTimeoutSeconds(value=40)


http://docs.oracle.com/cd/E16764_01/web.1111/e13720/annotations.htm#i1438354

It's a class annotation, and should be put on the same class you have your javax.ejb.Stateless (or Stateful) EJB.

e.g.

@Stateless(mappedName="myClass")
@TransactionTimeoutSeconds(value=50)
public class MyClass implements ...

No comments:

Post a Comment