Re: Programatically generating the database schema

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Oct 09 2003 - 20:13:56 EDT

  • Next message: Mike Kienenberger: "Re: Programatically generating the database schema"

    On Thursday, October 9, 2003, at 07:59 PM, Barry Walker wrote:

    > I'm sure it's possible since the modeler does it, but is there a
    > simple way to set up and generate the database schema from existing
    > cayenne.xml and associated files? I'm writing JUnit tests and I'd like
    > it to wipe the schema clean at the start of the tests.
    >

    Yeah, DbGenerator will do that:

    http://objectstyle.org/cayenne/api/cayenne/org/objectstyle/cayenne/
    access/DbGenerator.html

    Since it was created for internal purposes, API may not be all that
    friendly... But basically you need to get hold of a DataNode instance
    and get DbAdapter, DataMap, and DataSource from it. After that
    instantiate DbGenerator, call "setShould*" methods to configure what
    you (do not) want to generate... And then call "runGenerator".

    Andrus



    This archive was generated by hypermail 2.0.0 : Thu Oct 09 2003 - 20:13:50 EDT