Re: Dynamic Data Maps

From: Jonathan Carlson (Jonathan.Carlso..atun.com)
Date: Wed Jan 04 2006 - 18:24:56 EST

  • Next message: Steve Wells: "RE: Note to Cayenne/Tapestry users ..."

    Thanks!

    I see how DbLoader will create a DataMap, but I don't see how I can
    create a DataContext from a DataMap without using configuration files.

    I'm sorry if this is in the documentation and I missed it, but I didn't
    see it here:
    http://www.objectstyle.org/cayenne/userguide/datactxt/create.html

    I noticed Configuration.getSharedConfiguration(), but that seems to
    assume the use of configuration files.

    Any help would be appreciated! I think there could be a whole new
    class of Cayenne users if this were an easy thing to do (unless I just
    missed how easy it is already!). If I can get this working nicely, I'm
    going to share this method of using Cayenne on the Groovy mailing list
    (unless you don't want me to :-).

    - Jonathan

    >>> andru..bjectstyle.org 2006-01-04 7:08:37 AM >>>
    Sure. Cayenne DbLoader can do that. Just make sure you call
    "setGenericClassName(CayenneDataObject.class.getName())", before
    running it.

    Andrus

    On Jan 3, 2006, at 5:43 PM, Jonathan Carlson wrote:

    > Hi all, I'm pleased about the new generic DataObject capability in
    > Cayenne (although I have yet to try it).
    >
    > On a related note: Given all the attention given to
    > Rails/ActiveRecords and "convention over configuration", I was
    > wondering
    > if anyone had created a utility to dynamically generate a DataMap at
    > runtime from database metadata. Classes and properties could drop
    the
    > underscores in the table and column names (if desired), and
    > relationships could be generated from foreign key references.
    >
    > Has anyone done (or considered?) something like this? It would
    > make it
    > really nice companion to a scripting language like Groovy. Groovy
    SQL
    > is a step above straight JDBC, but this would be even better.
    Instead
    > of hand-coding all the SQL in Groovy, you could just point Cayenne
    to
    > the DB, create a Cayenne query to find your row(s) and seamlessly
    > navigate to all the related rows in the database. And with Cayenne
    > you'd have all the performance enhacers at your fingertips: like
    > prefetching, etc.
    >
    > I think that the only thing the utility might have trouble figuring

    > out
    > would be the unique ID generation information, but even that may be

    > able
    > to be inferred in some cases.
    >
    > - Jonathan
    >
    >
    ______________________________________________________________________
    > This email and any files transmitted with it are confidential and
    > intended solely for the use of the individual or entity to whom they
    > are addressed. If you have received this email in error please
    notify
    > the system manager.
    >
    > Katun Corporation -- www.katun.com
    >
    _____________________________________________________________________
    >

    ______________________________________________________________________
    This email has been scanned by the MessageLabs Email Security System.
    For more information please visit http://www.messagelabs.com/email
    ______________________________________________________________________

    ______________________________________________________________________
    This email and any files transmitted with it are confidential and
    intended solely for the use of the individual or entity to whom they
    are addressed. If you have received this email in error please notify
    the system manager.

    Katun Corporation -- www.katun.com
    _____________________________________________________________________



    This archive was generated by hypermail 2.0.0 : Wed Jan 04 2006 - 18:25:33 EST