I am trying to write the equivalent of the evolution / rollback mechanism of a Rails data model using Spring Jdbc.
Spring Jdbc transactionnal insert/replaceworks very well (DataSourceTransactionManager with PROPAGATION_REQUIRED in InnoDB mysql 5):
getJdbcTemplate().execute("replace into aTable ...");
getJdbcTemplate().execute("wrong request");
getJdbcTemplate().execute("replace into aTable ...");
but alternot:
// Transaction begins
getJdbcTemplate().execute("alter table aTable add column `columnForTest` ...");
getJdbcTemplate().execute("wrong request");
getJdbcTemplate().execute("alter table aTable add column `columnForTest` ...");
// the first alter is commited
Is there a way to achieve atomicity (all-or-nothing behavior) with alter?
Thanks in advance
source
share