cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Seeking to automate generation the cayenne schema
Date Tue, 04 Apr 2006 10:57:49 GMT
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 :)
>
>


Mime
View raw message