Re: CLOS and databases

From: Will Hartung (willh_at_msoft.com)
Date: 03/19/04


Date: Fri, 19 Mar 2004 14:10:31 -0800


"Erann Gat" <gNOSPAMat@jpl.nasa.gov> wrote in message
news:gNOSPAMat-1903041218500001@k-137-79-50-101.jpl.nasa.gov...
> In article <ptb8egyy.fsf@ccs.neu.edu>, Joe Marshall <jrm@ccs.neu.edu>
wrote:
> > That would end up requiring a transaction on every store!
>
> TANSTAAFL. But 1) it requires an update, not a transaction and 2) I have
> a scheme whereby multiple updates get queued up and only written to the DB
> when they're actually needed.

If you write to the DB (that is any standard generic modern SQL DB, and
specifically excluding mySQL), you get a transaction for every write no
matter what. The distinction being whether the transaction persists or
commits at the end of the write.

The other way, depending on what you want to do, is to simply flag the
entire object (and, perhaps the slot) for update and then on your Big Commit
you can either flush the entire thing, or if your noting slots, do a smart
update.

Obviously, one is simpler and more basic to do than the other.

It also depends on whether you want to be able to rollback object changes.

(setf object (make-instance 'persistent-user-class))

(setf (userid-key-slot object) "ID1234")

(retrieve object)

(print (first-name object))
"BOB"

(begin-transaction)

(setf (first-name object) "SAM")

(rollback-transaction)

(print (first-name object))

???

These are some of the fun problems persistence framework guys get to fight
with :-), and how "transparent" persistence really is/isn't.

Regards,

Will Hartung
(willh@msoft.com)



Relevant Pages

  • Re: chooses not to generate code at all
    ... > The point is that one does not need persistence to do ... > transaction processing. ... That's why you would still need a DBMS event if you don't need ... Other simpler tools can handle persistence in business transaction ...
    (comp.object)
  • Re: Programming to an Interface
    ... the business logic in a transaction would be hidden at the next level down. ... in the above we must assume that Transaction.execute takes the object being modified and saves it to the DB while locking out any concurrent changes. ... Still, the code above says nothing about RDB, tables, rows, or anything else at all about the persistence mechanism. ... So the author has successfully avoided the implementation of the RDB and programmed to the interface of only the Account object, and the Transaction object. ...
    (comp.object)
  • Re: Database transactions and data-state flags
    ... MTS would roll the update for both the Invoice and LineItems into one ... Transaction. ... Not sure what you mean by objects handling its own persistence. ...
    (microsoft.public.vb.general.discussion)