[TransWarp] __getitem__ on DM requires active transaction

Phillip J. Eby pje at telecommunity.com
Mon Dec 23 13:08:07 EST 2002

At 02:02 PM 12/23/02 +0200, Roch'e Compaan wrote:
>On Mon, Dec 23, 2002 at 12:33:34PM -0500, Phillip J. Eby wrote:
> > At 06:59 PM 12/23/02 +0200, Roch? Compaan wrote:
> >
> > >What if I want to retrieve an object from a DataManager and I am not in
> > >a transaction? Surely one doesn't have to be in a transaction if you
> > >simply want to retrieve an object?
> >
> > In your DM subclass, set:
> >
> > resetStatesAfterTxn = False
>I actually want the cache to be flushed between transactions - I just
>didn't think object retrieval required a transaction and it seems quite
>tedious to manually start a transaction whenever I want to
>retrieve something whereas "save", "new" and "delete" operations can
>automatically start a transactions.

No, they don't.  If you want transactions, you have to start them.  PEAK 
requires you to be explicit on this point in order to avoid programmer error.

Pretty much, if you're dealing with 'peak.storage' and you're not using 
unflushed data managers, you must begin a transaction.  It's not 
particularly tedious; the shortest general spelling is simply:


or if you have only one transaction for the whole application, just:


Anyway, since there is no way to flush the cache between transactions 
unless the data manager has joined a transaction, and a transaction must 
exist to be joined, how can a data manager ensure that it will be able to 
clear its cache without a current transaction?

More information about the PEAK mailing list