[TransWarp] __getitem__ on DM requires active transaction

Roch'e Compaan roche at upfrontsystems.co.za
Mon Dec 23 07:55:02 EST 2002

> >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.

No, they don't  - I meant to say "can potentially". I was thinking that
create/delete/edit operations on objects can either cause the
DataManager to start or join a transaction without the programmer having
to worry about it at all. I realise now that this can only work if I
have a single transaction for the whole app or if there are logical
start and endpoints for a transaction like a web request and response.

> 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:
> storage.begin(yourDataManager)

Sure, this is short enough :-)

Roché Compaan
Upfront Systems                 http://www.upfrontsystems.co.za

More information about the PEAK mailing list