So here is the direction I am initially looking to address this issue... I created a new "DdlTransactionIsolator" contract, which in part, represents the before/after transactional behavior specific to each "transactional environment" (TransactionCoordinatorBuilder):
public interface DdlTransactionIsolator {
JdbcContext getJdbcContext();
void prepare();
Connection getIsolatedConnection();
void release();
}
And added a new TransactionCoordinatorBuilder#buildDdlTransactionIsolator method. This allows us to have behavior specific to each of JtaTransactionCoordinatorBuilderImpl and JdbcResourceLocalTransactionCoordinatorBuilderImpl in terms of before and after processing all DDL. In DdlTransactionIsolatorJtaImpl, e.g., I use that to suspend any current transaction before we start executing DDL and resume it after. I'll get a PR ready. But I wanted to wait for others to have time to look at this and also to wait to allow Scott some time to reply. |