IDEMPIERE-5726 2Pack: TableElementHandler should reset Table cache after commit of transaction (#1843)
This commit is contained in:
parent
d2426c5ebd
commit
c05d2cefa9
|
@ -45,8 +45,10 @@ import org.compiere.model.X_AD_Package_Exp_Detail;
|
||||||
import org.compiere.model.X_AD_Package_Imp_Detail;
|
import org.compiere.model.X_AD_Package_Imp_Detail;
|
||||||
import org.compiere.model.X_AD_Table;
|
import org.compiere.model.X_AD_Table;
|
||||||
import org.compiere.process.DatabaseViewValidate;
|
import org.compiere.process.DatabaseViewValidate;
|
||||||
|
import org.compiere.util.CacheMgt;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Trx;
|
import org.compiere.util.Trx;
|
||||||
|
import org.compiere.util.TrxEventListener;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
import org.xml.sax.helpers.AttributesImpl;
|
||||||
|
|
||||||
|
@ -123,6 +125,27 @@ public class TableElementHandler extends AbstractElementHandler {
|
||||||
throw new DatabaseAccessException("Failed to validate view for " + mTable.getName());
|
throw new DatabaseAccessException("Failed to validate view for " + mTable.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Trx trx = Trx.get(getTrxName(ctx), false);
|
||||||
|
if (trx != null && !mTable.isView()) {
|
||||||
|
trx.addTrxEventListener(new TrxEventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterRollback(Trx trx, boolean success) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCommit(Trx trx, boolean success) {
|
||||||
|
if (success) {
|
||||||
|
CacheMgt.get().reset(MTable.Table_Name, mTable.get_ID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterClose(Trx trx) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int validateDatabaseView(PIPOContext ctx, MTable table)
|
private int validateDatabaseView(PIPOContext ctx, MTable table)
|
||||||
|
|
Loading…
Reference in New Issue