X web hosting - Conversations with EJB 3.0 Table 11.1 EJB 3.0
Friday, November 30th, 2007Conversations with EJB 3.0 Table 11.1 EJB 3.0 declarative transaction attribute types Attribute name Description REQUIRED A method must be invoked with a transaction context. If the client doesn t have a transaction context, the container starts a transaction and enlists all resources (datasources, and so on) used with that transaction. If this method calls other transactional components, the transaction is propagated. The container commits the transaction when the method returns, before the result is send to the client. NOT_SUPPORTED If a method is invoked within the transaction context propagated from the client, the caller s transaction is suspended and reactivated when the method returns. If the caller has no transaction context, no transaction is started for the method. All used resources aren t enlisted with a transaction (autocommit occurs). SUPPORTS If a method is invoked within the transaction context propagated from the client, it joins that transaction context with the same result as REQUIRED. If the caller has no transaction context, no transaction is started, with the same result as NOT_SUPPORTED. This transaction attribute type should be used only for methods that can handle both cases correctly. REQUIRES_NEW A method is always executed inside a new transaction context, with the same consequences and behavior as with REQUIRED. Any propagated client transaction is suspended and resumes when the method returns and the new transaction is completed. MANDATORY A method must be called with an active transaction context. It then joins this transaction context and propagates it further, if needed. If no transaction context is present at call time, an exception is thrown. NEVER This is the opposite of MANDATORY. An exception is thrown if a method is called with an active transaction context. You have to be aware of the transaction- and persistence-context propagation rules when you design your conversations with stateful EJBs, or if you want to mix stateless and stateful components: If a stateful session bean that has an extended persistence context calls (effectively instantiates) another stateful session bean that also has a persistence context, the second stateful session bean inherits the persistence context from the caller. The lifecycle of the persistence context is bound to the first stateful session bean; it s closed when both session beans have been removed. This behavior is recursive if more stateful session beans are involved. This behavior is also independent of any transaction rules and transaction propagation.
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.