Hello,
I've got major problems with my transaction-rollback implementation, and I'm reading manuals for over two days now (I really like
http://svn.nuxeo.org/nuxeo/ECMPlatform/NXCore/trunk/doc/Transactions.txt ), and I'm getting frustrated.
The problem is fairly easy; I'm implemention a user-registration action bean, RegisterAction, that implements IRegister, marked @Local. Here it is:
@Stateful
@Scope(CONVERSATION)
@Name("register")
public class RegisterAction implements IRegister
{
@In(create=true) @Out
private Person currentUser;
@In(create=true) @Out
private LoginEntity loginEntity;
@PersistenceContext
private EntityManager em;
public RegisterAction()
{
}
@Rollback(ifOutcome= {"failure"})
@End
public String register()
{
try {
this.em.persist(this.currentUser);
this.em.persist(this.loginEntity); //this one throws an Exception
}
catch (Exception e) {
return "failure";
}
return "success";
}
@Remove @Destroy
public void destroy()
{
}
}
I think what you are doing should work. What database are you using?