Re: how to get update/insert SQL without committing to db

From: tobias.schoessle..nodc.org
Date: Thu Feb 21 2008 - 15:37:33 EST

  • Next message: Malcolm Edgar: "Re: How to migrate from Hibernate to Cayenne?"

    Andrus thank you for this suggestion. I notice that I am actually not interested in the update/insert SQL on commit to solve my problem. but existing DataObjects themselves and their interconnection. backup restore the whole database would be a solution, yes but I would like to only transfer parts of the actual database. I would like to use the business logic already coded to get only those related records for transfer. I do realize that this is not a update/change operation but a selection/query. I would look for something that creates an insert statement for an existing DataObject. I think this is easy to do manually with the information avaiable in the cayenne mapping info. (sorry for thinking aloud here and posting before thinking)

    Tobias

    Andrus Adamchik <andru..bjectstyle.org> wrote:
    Tracing all changes can be accomplished by other means, e.g. via
    recording all GraphDiffs before commit (GraphDiffs are the internal
    format Cayenne uses to store object changes, that are later
    transformed to SQL).

    However I'd recommend investigating a DB-level backup solution, as a
    much more robust alternative. E.g. take a periodic production data
    dump, load it to the dev DB, then run some SQL script to make sure the
    data is appropriately massaged for the dev environment. This should
    work for the databases up to a certain size. Of course if you have
    terabytes of data, then it won't scale (or require a more fine grained
    approach to backup creation).

    Andrus

    On Feb 21, 2008, at 5:49 PM, Tobias SCHOESSLER wrote:
    > Hi Andrus, I did in fact forget about that.
    >
    > I was looking for an easy way to recreate parts of the object
    > network to transfer between stages of our application. E.g. create
    > SQL for a data set to insert it in the development db for testing.
    >
    > Tobias
    >
    >
    > Andrus Adamchik <andru..bjectstyle.org>
    > Thursday, 21 February 2008 14:38
    > Please respond to
    > use..ayenne.apache.org
    >
    > To
    > use..ayenne.apache.org
    > cc
    > Subject
    > Re: how to get update/insert SQL without committing to db
    >
    >
    >
    >
    >
    > Hi Tobias,
    >
    > Could you elaborate a bit on how are you going to use this SQL? SQL
    > generated by Cayenne is in a PreparedStatement format, so it will not
    > be usable for say manual execution from a SQL client.
    >
    > Andrus
    >
    >
    >
    > On Feb 21, 2008, at 2:55 PM, Tobias SCHOESSLER wrote:
    > > Hi,
    > >
    > > is there a way to get the update/insert SQL statements ( e.g. as a
    > > String ) that cayenne would execute with a commit, without actually
    > > committing to the db?
    > >
    > > thank you
    > >
    > > Tobias
    >
    >

    ___
     sent via WebmailLight 3.1.15



    This archive was generated by hypermail 2.0.0 : Thu Feb 21 2008 - 15:38:07 EST