What is the default time for transaction manager? And how to set maximum time(timeout) for transaction?.

Nick Maiorano

The default time depends on your app server. It is usually around 30 seconds. If you are using bean-managed transactions, you can set it like this:

// One of the methods from the SessionBean interface
public void setSessionContext(SessionContext context) throws EJBException
sessionContext = context;

// Then, when starting a new transaction
UserTransaction userTransaction = sessionContext.getUserTransaction();
// do stuff

If you are using container-managed transactions, this value is set in a app server specific way. Check your app server's deployment descriptor DTD.

About | Sitemap | Contact