Re: Transaction confirmation.

From: Scott Ellsworth (scot..lodar.com)
Date: Fri Feb 06 2004 - 14:33:38 EST

  • Next message: Andrus Adamchik: "Re: Newbie, retrieving list from specific class DataObjects"

    On Feb 6, 2004, at 10:53 AM, Andrus Adamchik wrote:

    > Hi,
    >
    > On Feb 6, 2004, at 4:06 AM, Vassilis Raxenidis wrote:
    >> Of course if no exception is
    >> thrown on commitChanges() call, it is safe to consider the object as
    >> deleted. But what happens if an exception is thrown when the
    >> commitChanges()
    >> is called. In such a case how can I be sure whether the object is
    >> deleted or
    >> not?
    >
    > "DataContext.commitChanges" never throws an exception after a
    > successful commit. So you can rely on it. Here is some details.
    >
    > Places where it does throw and exception are:
    >
    > 1. Object validation (in Cayenne 1.1, but not 1.0) - this happens
    > before the actual DB commit starts, and therefore means that your
    > object has not been deleted.
    > 2. During DB commit - if a DB-level error occurred - in this case DB
    > transaction is rolled back, "undeleting" your object.
    >
    >
    > Places where things can still mess up are:
    >
    > 1. If you are running MySQL or other database with no real DB
    > transactions so "rollback" has no effect. I don't think Cayenne can
    > help here - switching to a real DB maybe the best option.

    This is a good reason to use InnoDB tables with MySql. They do support
    transactions, and are reasonably zippy.

    Starting with 4.1.1, you now can ask for a separate log per table - a
    big win given that innodb files never shrink in size.

    Scott



    This archive was generated by hypermail 2.0.0 : Fri Feb 06 2004 - 14:33:40 EST