// Do the "sub" transaction
// - the txm doesn't really commit,
// because we keep track of who's the tx owner.
boolean notTxOwner = txm.begin();
em.persist(mainObject);
txm.commit(notTxOwner);
// Finish the transaction off
em.persist(subObject);
txm.commit(txOwner);
}