Re: Seeking to automate generation the cayenne schema

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Apr 04 2006 - 06:57:49 EDT

  • Next message: Andrus Adamchik: "Re: commit error with cayenne 1.1.4 ,tomcat 5 and mysql 5"

    Everything in Cayenne can be assembled via API. So you'd go about
    assembling Cayenne stack in the following order:

    * create DefaultConfiguration
    * add DataDomain
    * add DataNode
    * add DataMap (using org.objectstyle.cayenne.access.DbLoader to
    create it from DB on the fly)

    Also since a generic DataObject class is supported, this will even
    work in Java:

    http://objectstyle.org/confluence/display/CAYDOC/Generic+Persistent
    +Class

    Andrus

    On Apr 4, 2006, at 12:24 PM, Craig Turner wrote:

    > In short: is there a command-line or API-driven way of creating a
    > cayenne configuration by pointing at an existing schema or is the
    > modeler the only supported approach? Cgen should be OK for
    > generating the classes, but I'm interested in an earlier step -
    > generating the XML configuration itself.
    >
    > --
    >
    > I'm in the process of writing a framework with cayenne 1.2 as one
    > of the components [1]. It's driven from the command-line. Eg:
    > sf create project name com.base.of.java.package
    >
    > For this paticular operation I'd like to be able to do this:
    > sf create project name com.base.of.java.package jdbc:uri
    > com.db.Driver
    >
    > It's my intention that this should create a project of the supplied
    > name and base backage and generate a cayenne setup based on the
    > supplied url and database driver.
    >
    > Is it straightforward to generate a configuration this way with
    > existing tools? I'm guessing it won't be too difficult to either
    > hack the modeler to do this without user interaction or else
    > generate my own XML based on JDBC inspection, but I'd far prefer to
    > do it through a supported approach if one is available.
    >
    > - C
    >
    > [1] I'm writing it in python. The other main dependencies are
    > tapestry 4 and tomcat. Some readers may notice a passing
    > resemblance to a certain set of perl-based webobjects tools :)
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Apr 04 2006 - 06:58:18 EDT