T R A N S A C T I O N S  
That when a new transaction is created in the transaction interceptor this 
transaction ends when the call returns to the transaction interceptor. If a system 
exception (either a java.rmi.RemoteException or a java.lang.RuntimeException) is 
thrown the transaction interceptor will rollback the transaction, otherwise it will 
commit the transaction. When a bean does not want to throw a system exception 
but wants the transaction rolled back it can mark the transaction for rollback using 
the javax.ejb.EJBContext.setRollbackOnly(). When a transaction is marked for 
rollback it is impossible to commit the transaction, and the only possible outcome is 
a rollback. From the caller s view these two ways looks the same because the 
transaction interceptor will throw an exception indicating that the transaction is 
rolled back. The caller can decide, if it is another bean, if it wants to go on with its 
own transaction by catching this exception; otherwise the exception will propagate 
out of the bean code, and the original transaction will be rolled back, too. 
How to set the Transaction Attributes 
The transaction attributes are set in the EJB deployment descriptor  ejb jar.xml . You can 
set a transaction attribute for all methods, for a particular method name or for a particular 
method (specified by its parameters) whereas the more specific specification overwrites the 
less specific one. The part in the EJB deployment descriptor defining the transaction 
attributes could look like: 
 
    
      bank/CustomerSession 
      * 
    
   Required 
 
 
    
      bank/CustomerSession 
      Remote 
      createCustomer 
   Mandatory 
 
 
    
      bank/CustomerSession 
      Remote 
      createCustomer 
       
         java.lang.String 
         java.lang.String 
         float 
       
    
   RequiresNew 
57






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

best web hosting

 

Our partners: PHP: Hypertext Preprocessor Cheap Web Hosting JSP Web Hosting Ontario Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Java Hosting Cheapest Hosting

Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved