Use UserTransaction from stateless session bean and set bean transaction to bean managed transaction so you will have good control. You can also use just ordinary
Java class outside container. I asume that you are using Entity Beans (transaction in each is set to required)
Here is sample code (from my mind):
String lookup = "jta/usertransaction";
UserTransactiontx = (UserTransaction)initial.lookup(lookup);
if (tx != null) {
tx.begin();
bean1.create("blablaPK");
bean2.create("blablaPK2");
tx.commit();
success=true;
catch(...){success=false;...}
} finally {
if (success) {
try {
tx.commit();
} catch (Exception e1) {..}
} else {
try {
tx.rollback();
} catch (Exception e1) {..}
}
}