IDEMPIERE-3816 Deadlock in 2Pack after creating a foreign key constraint with AD_Sequence

This commit is contained in:
Carlos Ruiz 2018-11-10 23:19:17 -02:00
parent f39116d95d
commit bc99a2669c
1 changed files with 3 additions and 1 deletions

View File

@ -426,12 +426,14 @@ public class PackInHandler extends DefaultHandler {
String fkConstraintSql = MColumn.getForeignKeyConstraintSql(md, catalog, schema, tableName, table, column, false);
if (! Util.isEmpty(fkConstraintSql)) {
if (fkConstraintSql.toLowerCase().contains(" ad_sequence(ad_sequence_id)"))
fkConstraintSql = fkConstraintSql + "; COMMIT";
if (fkConstraintSql.indexOf(DB.SQLSTATEMENT_SEPARATOR) == -1) {
DB.executeUpdate(fkConstraintSql, false, m_ctx.trx.getTrxName());
} else {
String statements[] = fkConstraintSql.split(DB.SQLSTATEMENT_SEPARATOR);
for (int i = 0; i < statements.length; i++) {
if (Util.isEmpty(statements[i]))
if (Util.isEmpty(statements[i], true))
continue;
DB.executeUpdateEx(statements[i], m_ctx.trx.getTrxName());
}