Я пытаюсь использовать FlyWay 6.0.Beta2 BaseJavaMigration и Mysql
@Slf4j
public class V1_7__ini_cf_template_2019_07_1 extends BaseJavaMigration {
@Override
public void migrate(Context context) throws Exception {
log.info("111");
try (Connection connection = context.getConnection()) {
log.info("222");
try (PreparedStatement statement = connection.prepareStatement(
"insert into console.customers_settings (settings_customer_id, start_balance, max_balance_allowed, max_instance_allowed) values (?, ?, ?, ?)")) {
log.info("333");
statement.setLong(1, 3);
statement.setBigDecimal(2, new BigDecimal(100));
statement.setBigDecimal(3, new BigDecimal(200));
statement.setBigDecimal(4, new BigDecimal(300));
statement.executeUpdate();
}
}
}
}
Почему-то я получаю ошибку
Невозможно откатить транзакцию
java.sql.SQLNonTransientConnectionException: операции не разрешены после закрытия соединения.
И запросы вида. Хорошо работать
https://flywaydb.org/getstarted/java
public class V3__Anonymize extends BaseJavaMigration {
public void migrate(Context context) throws Exception {
try (Statement select = context.getConnection().createStatement()) {
try (ResultSet rows = select.executeQuery("SELECT id FROM person ORDER BY id")) {
while (rows.next()) {
int id = rows.getInt(1);
String anonymizedName = "Anonymous" + id;
log.info(anonymizedName);
}
}
}
}
}
}
В чем может быть причина