You can override the doDML method and get the changes before call super.doDML();
Code with example:
@Override
protected void doDML(int operation, TransactionEvent event) {
if (operation == DML_UPDATE) {
final String ORDER_ID = "OrderId";
// get posted value of OrderId attribute
// this method is to get the old value before change
Object oldOrderId = getPostedAttribute(this.getAttributeIndexOf(ORDER_ID));
// get value of OrderId after change
Object newOrderId = this.getAttribute(ORDER_ID);
// compare and take some action based on the results of comparison
if (newOrderId != null && newOrderId.equals(oldOrderId)) {
//do sth. here
//System.out.println("Order Id changed from " + oldOrdreId + " to " + newOrderId);
}
// finally calling super.doDML()
super.doDML(operation, event);
}
}