Login  Register

Aw: Re: Rolling back twice

Posted by jtuchel on May 11, 2011; 1:25pm
URL: https://forum.world.st/Rolling-back-twice-tp3514457p3514683.html

Okay, I tried it and slo far it seems to work nicely.

Here's what I added to GlorpSession:

rollbackAndContinue
    "A shorter synonym"
    ^self rollbackUnitOfWorkAndContinue.

rollbackUnitOfWorkAndContinue
    "Rollback the current unit of work, but then keep going with the same set of registered objects, with their state updated to reflect current values."

    | registeredObjects |  
    currentUnitOfWork isNil ifTrue: [^self error: 'Not in unit of work'].
    registeredObjects := currentUnitOfWork registeredObjects.
    currentUnitOfWork newObjects do: [:each | registeredObjects remove: each].
    self rollbackUnitOfWork.
    self beginUnitOfWork.
    self registerAll: registeredObjects.

So far, it seems I have no troubles and have no need to re-register or refresh objects after a rollback, since the re-registering is done in rollbackUnitOtWorkAndContinue.

Since I am neither using a current version of GLORP, nor have a current version of VW at my fingertips, I cannot publish any changes to Glorp anywhere. But they're probably in a good place on this list if anybody wants to harvest the code into a new release.

Thanks, Alan, for your hints. Please feel free to tell me if my thinking about new objects is wrong (since I am not completely sure).

Joachim

--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/glorp-group?hl=en.