[Modeling-users] saveChanges() doesn't change globalID
Status: Abandoned
Brought to you by:
sbigaret
From: Marcos D. <md...@vi...> - 2004-09-08 22:12:43
|
User-Agent: Mutt/1.3.28i hi all. I'm experimenting since a few months w/ building a rollback scheme above modeling. the problems I found were this: given a EditingContext, there a re two kind of objects registered at the moment fo saveChanges(): from-database ones (globalID() is an instance of KeyGlobalID), and new ones (globalID() is an instance of TemporaryGlobalID). when I roll back, I do the following: * 'hold' the model: any from-database object gets hold by means of snapshot_raw(). new ones are simply forgoten. * build a new EditingContext. * repopulate it with the old objects. from-database ones get reinserted via faultForRaw(), and new ones simply requesting a new instance of the proper class. this works fine, but a probblem arises: if I create a new object, add it to the EditingContext(), then saveChenges(), it *sometimes* gets converted to a from-database one (which is what I would mostly spect; see definition above) and sometimes it doesn't (which would not be so bad if it wouldn't be just 'sometimes'). keep in mind that now I'm just playing with only one entity, so it doesn't seem to be an entity problem, if you know what I mean. is this possible (the sometimes part), could it be a bug in Modeling, or I'm just getting lucky sometimes? which would be the spected behaviour? if you need some code I can post it tomorrow. TIA. |