By:
Martin Nichol
April 4th, 2018
We’ve all seen the dreaded “Record has been updated by another user. Refetch and try again.” It can happen when the record has been updated by another user, but it can also happen when the record is updated by the same user more than once. In memory, an MboSet owns zero or more MBOs. Each of those MBOs can have zero or more MboSets which in turn own zero or more MBOs. Naturally, if your MboSets contain zero MBOs you won’t have problems with records updated by another user. Problems will arise if two different MBOs reference the same database record and both MBOs attempt to update data. In memory, these MBOs will be represented as separate Java objects and will be owned by different MboSets. If only one MBO is updated, it won’t be a problem. If both MBOs are updated, the first will update the database record and change the ROWSTAMP value. The second will attempt to update the record but will fail because the ROWSTAMP doesn’t match. This will trigger an MXRowUpdateException.