Re: Mixing object and id-based access in a single transaction

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sat Jan 28 2006 - 15:16:32 EST

  • Next message: Chronos: "Re: Problems with MAX"

    Hi! You can either configure Cayenne to use external transactions
    (such as J2EE, Spring) by checking "Container Managed Transactions"
    on the DataDomain or set a DataDomain TransactionDelegate,
    implementing "willCommit" to insert your data.

    http://objectstyle.org/cayenne/userguide/design/transactions.html
    http://objectstyle.org/cayenne/api/cayenne/org/objectstyle/cayenne/
    access/TransactionDelegate.html

    Andrus

    On Jan 27, 2006, at 11:38 AM, Heiko.Erhard..i-de.com wrote:

    >
    > We need to insert the following information into the database in a
    > single
    > transaction:
    >
    > - A regular Cayenne object (e. g. a 'Project') that is described in
    > the
    > mapping file
    > - Several tables that depend on the Project (i. e. use the primary
    > key of
    > the Project as their foreign key).
    >
    > However, there are no mapping descriptions for the dependent
    > tables. We
    > just know table names, column names and values.
    > We use an InsertBatchQuery to insert the table data.
    >
    > The problem is the foreign key of the dependent tables.
    > This key is generated when the Project table is saved, i. e.
    > commitChanges
    > is called.
    > commitChanges implicitely begins and commits a database transaction.
    > We would like to include the operations done by our custom
    > InsertBatchQuery
    > into this transaction.
    >
    > Is there a way to do this (or to externalize the transaction
    > control, i. e.
    > control begin and commit time of the transaction ourselves).
    >
    > Any help highly appreciated!
    > --
    > Heiko Erhardt
    >
    >



    This archive was generated by hypermail 2.0.0 : Sat Jan 28 2006 - 15:16:35 EST