I don't think I need to call an explicit flush here, but correct me if I'm
wrong.

The local EJB code:
@Stateless
public class TestServiceImpl {

    @PersistenceContext(unitName = "test-web")
    private EntityManager em;

    @EJB(mappedName = "jndi:ext://testProvider/Test2ServiceImplRemote")
    private TestService remoteService;

    public void test() {
        Test t = new Test();
        t.setTest("test");
        this.em.persist(t);
        this.remoteService.test(); //call remote service
        throw new RuntimeException("rollback pls!");
    }
}


The remote EJB:
@Stateless
public class Test2ServiceImpl implements TestService {

    @PersistenceContext(unitName = "test-remote-web")
    private EntityManager em;

    @Override
    public void test() {
        Test2 t = new Test2();
        t.setTest("test");
        this.em.persist(t);
    }
}




--
View this message in context: 
http://openejb.979440.n4.nabble.com/Postgres-XA-transaction-rollback-tp4666429p4666432.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to