In DObject O/R Mapping persistence layer, while the transaction rolling back, the state of object related with transaction will also rollback to what it was the last committed or original. Sample: Rollback
|
var region : IRegion; region2 : IRegion; msg : string; begin ObjectManager.BeginTransaction; region := TRegion.Create(ObjectManager); region.RegionID := -999; region.RegionDescription
:=
'-999'; msg := BoolToStr(region.RegionDescription
=
'-999', true); region.Save; msg := msg + ', ' + BoolToStr(region.RegionDescription
=
'-999', true); ObjectManager.Rollback; msg := msg + ', ' + BoolToStr(region.RegionDescription
=
'', true); region2 := TRegion.GetByRegionID(ObjectManager, -999); msg := msg + ', ' + BoolToStr(region2 = nil, true); StatusBar.SimpleText := msg; end; |
|
--output result-- |
|
True, True, True, True |
Related Topics