10-24-2009 10:43 PM
I have a little problem with how peristent object behave:
Current behaviour:
1. I store an object using storeObject.commit();
2. I make changes to the object.
3. Retrieve object using storeObject.getContents();
4. Object is in the same state as it was before. All changes made after the commit() are still there.
Desired behaviour:
1. I store an object using storeObject.commit();
2. I make changes to the object.
3. Retrieve object using storeObject.getContents();
4. Object is in the state, as it was at the time I did the commit(), therefore all changes made after the commit() are dismissed.
Is that possible? Thanks! ![]()
Solved! Go to Solution.
10-25-2009 06:44 AM
The behavior you are seeing is what I have noted too. I remember asking if this was expected and getting the response, I believe from msohm, that this was what would happen but if the device was reset (battery out) the data would revert to the pre-committed state. You could test to see if you see this behavior too.
In addition, if another application requests access to the same persistent object, they will see the changed state before the commit.
You won't find the response from msohm on this forum, I asked the question in the old forum, it was that long ago!
The result is that I clone objects where I'm want to be able to discard changes.
10-25-2009 08:36 AM
You're right, after a hard-reset my objects are reverting, too. Wasn't quiet the behaviour I was expecting. Guess I also need to clone my objects - although I was kinda trying to avoid that. Thanks!