[ 1898050 ] PO.delete trx management bug
This commit is contained in:
parent
7527c2e9b8
commit
bb271ef34d
|
@ -2605,6 +2605,19 @@ public abstract class PO
|
||||||
} // processed
|
} // processed
|
||||||
} // force
|
} // force
|
||||||
|
|
||||||
|
Trx localTrx = null;
|
||||||
|
boolean success = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
String localTrxName = m_trxName;
|
||||||
|
if (localTrxName == null)
|
||||||
|
{
|
||||||
|
localTrxName = Trx.createTrxName("POdel");
|
||||||
|
localTrx = Trx.get(localTrxName, true);
|
||||||
|
m_trxName = localTrxName;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!beforeDelete())
|
if (!beforeDelete())
|
||||||
|
@ -2635,13 +2648,7 @@ public abstract class PO
|
||||||
log.saveError("Error", errorMsg);
|
log.saveError("Error", errorMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Trx localTrx = null;
|
|
||||||
String localTrxName = m_trxName;
|
|
||||||
if (localTrxName == null)
|
|
||||||
{
|
|
||||||
localTrxName = Trx.createTrxName("POdel");
|
|
||||||
localTrx = Trx.get(localTrxName, true);
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
deleteTranslations(localTrxName);
|
deleteTranslations(localTrxName);
|
||||||
// Delete Cascade AD_Table_ID/Record_ID (Attachments, ..)
|
// Delete Cascade AD_Table_ID/Record_ID (Attachments, ..)
|
||||||
|
@ -2653,7 +2660,7 @@ public abstract class PO
|
||||||
.append(" WHERE ")
|
.append(" WHERE ")
|
||||||
.append(get_WhereClause(true));
|
.append(get_WhereClause(true));
|
||||||
int no = DB.executeUpdate(sql.toString(), localTrxName);
|
int no = DB.executeUpdate(sql.toString(), localTrxName);
|
||||||
boolean success = no == 1;
|
success = no == 1;
|
||||||
|
|
||||||
// Save ID
|
// Save ID
|
||||||
m_idOld = get_ID();
|
m_idOld = get_ID();
|
||||||
|
@ -2666,8 +2673,6 @@ public abstract class PO
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (localTrx != null)
|
|
||||||
success = localTrx.commit();
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
// Change Log
|
// Change Log
|
||||||
|
@ -2711,9 +2716,6 @@ public abstract class PO
|
||||||
log.warning("Not deleted");
|
log.warning("Not deleted");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (localTrx != null)
|
|
||||||
localTrx.close();
|
|
||||||
localTrx = null;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -2735,6 +2737,25 @@ public abstract class PO
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
if (localTrx != null)
|
||||||
|
localTrx.rollback();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (localTrx != null)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
localTrx.commit(true);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.saveError("Error", e);
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Reset
|
// Reset
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
|
@ -2744,6 +2765,15 @@ public abstract class PO
|
||||||
m_newValues = new Object[size];
|
m_newValues = new Object[size];
|
||||||
CacheMgt.get().reset(p_info.getTableName());
|
CacheMgt.get().reset(p_info.getTableName());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (localTrx != null)
|
||||||
|
{
|
||||||
|
localTrx.close();
|
||||||
|
m_trxName = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
// log.info("" + success);
|
// log.info("" + success);
|
||||||
return success;
|
return success;
|
||||||
} // delete
|
} // delete
|
||||||
|
|
Loading…
Reference in New Issue