Yes I managed to do this:
Code:
public class Test1 {
public static void main(String[] args) throws SQLException, XAException {
XAConnection xaCon;
XAResource xaRes;
Xid xid1;
Xid xid2;
Connection con;
Statement stmt;
int ret;
xaCon = OracleUtils.getXAConnection();
xaRes = xaCon.getXAResource();
con = xaCon.getConnection();
stmt = con.createStatement();
xid1 = new OracleXID(100, new byte[]{0x01}, new byte[]{0x02});
xid2 = new OracleXID(100, new byte[]{0x11}, new byte[]{0x22});
// start and suspend the first transaction's branch
xaRes.start(xid1, XAResource.TMNOFLAGS);
stmt.executeUpdate("insert into x1 values (1)");
xaRes.end(xid1, XAResource.TMSUSPEND);
// start second transaction's branch
xaRes.start(xid2, XAResource.TMNOFLAGS);
stmt.executeUpdate("insert into x2 values (2)");
xaRes.end(xid2, XAResource.TMSUCCESS);
//prepare and commit second transaction's branch
ret = xaRes.prepare(xid2);
if (ret == XAResource.XA_OK) {
xaRes.commit(xid2, false);
}
//resume, prepare and commit first transaction's branch
xaRes.start(xid1, XAResource.TMRESUME);
ret = xaRes.prepare(xid1);
if (ret == XAResource.XA_OK) {
xaRes.commit(xid1, false);
}
}
}
I can conclude that oracle support such behavior))