// class is not annotated
public class AuthenticationService {

    @Inject 
    private UserDAO userDAO;  

   @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    private void inner() throws Exception {
        
        User user = userDAO.findByName("scott");        
        user.setUserName("rick"); 

        userDAO.update(user); // will fire EntityExistException because there
is already record with that name        
    }
    
    public AuthenticationServiceObject outer() {

        User user = userDAO.findByName("tiger");  
        gebruikerDAO.update(gebruiker); 
        
        try {                   
                inner();
        } catch (Exception e) {                 
                System.out.println("INNER FAILS: " + e.getMessage()); 
        }
        return new AuthenticationServiceObject(0, "blahblah");
    }
}



--
View this message in context: 
http://openejb.979440.n4.nabble.com/handling-new-transaction-inside-transaction-does-not-work-tp4660716p4660719.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to