Transactions , Primary Keys

From: Philip Copeland (pcopelan..voka.com)
Date: Sat Sep 22 2007 - 18:26:45 EDT

  • Next message: Aristedes Maniatis: "Re: Optimize cascade deletes"

    Hi,

     

    We've used Cayenne extensively over the last 2 years - with great
    success on many projects.

     

    I'm in the process of designing & implementing a generic import/export
    feature for some of our projects - and its raising some difficult issues
    that I don't know how to resolve. We're currently using the 1.2 code
    base and generally use the database generated Primary Key option. The
    import/export raise challenges because its potentially dealing with very
    large amounts of data - and the hard part is that I need to "remap" the
    foreign key relationships as part of the process. We've though of
    several ways of doing this but they all involve being able to query
    objects that have not yet been written to the database. At the same time
    the import needs to happen as a "transaction" so that it can be rolled
    back if something fails.

     

    The main problem I'm facing is that objects don't get written to the
    database (nor Primary Keys generated) unless we commit our transaction.
    What I'm wishing for is a mode where all changes are made to the
    underlying database - but not committed until I have completed all the
    work I need to do. The central issue is that I need to be able to
    perform database queries on objects that are uncommitted (and part of my
    current transaction) - and I don't have a way to do this at present with
    Cayenne. The though of having to go back to JDBC for this is not
    attractive.

     

    The more I think about this - the more I wonder why the "write or save"
    function is not handled separately from a "commit".

     

    I'd be very interested if anyone has suggestions.

     

    Thanks

     

    Philip

     



    This archive was generated by hypermail 2.0.0 : Sat Sep 22 2007 - 18:28:03 EDT