Re: New User alert

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Dec 02 2004 - 14:37:37 EST

  • Next message: Andrus Adamchik: "[Fwd: Re: New User alert]"

    Hi Jin,

    Glad the Modeler worked out for you ;-) As far as Cayenne documentation,
    the one that comes with download (same as docs on the site) is the most
    comprehensive docs available... So if you have specific unaswered
    questions, this list is the best resource.

    As for general recommendation on learning ORM... There is a number of
    high-minded theoretical papers on the patterns involved, the so-called
    "object relational impedance", etc. My recommendation is to stay away from
    them for now ;-) Actually starting using a tool like Cayenne should be the
    best way to gain the understanding (and develop working code in the
    process).

    Ignoring the "impedance" for a moment, ORM is really simple if you have a
    basic idea of how a database is structured (tables and PK/FK relationships
    between tables). In Java each table will have a corresponding DataObject
    class. Each "relationship" is simply a property of a DataObject (in a
    classic JavaBean sense) that points to another DataObject class. So in
    many common cases your DB and your object model have identical logical
    structures. What remains is the technicality of mapping, and that where
    Modeler helps a lot.

    CayenneModeler reverse-engineering and class generation features should
    give you a good starting point in showing what your object model might
    look like for an existing database schema. Just examine generated mapping
    and Java code - this is your self-explanatory sample on Cayenne "best
    mapping practices".

    From there you need to figure out a few more API-related things:

    1. How to obtain a DataContext (we have a Tapestry example - in a simplest
    case, just instantiate it in the Visit)
    2. How to build and run SelectQuery to obtain the initial objects set
    3. How to get to the related objects (very simple - call a relationship
    get method)
    4. How to modify objects (just call setXYZ method)
    5. How to create/delete objects (use corresponding DataContext methods)
    6. And finally DataContext.commitChanges()

    These simple operations probably constitute 70-80% of Cayenne work in a
    typical app. You'll discover the rest (advanced mapping options, query
    optimizations, etc.) as you go.

    Good luck!
    Andrus

    > Hey all,
    >
    > I just found out about cayenne through the tapestry mailing list and
    > also through the frustrations I had with Hibernate. So far looks
    > great! I love the GUI modeler :)
    >
    > I am really trying to learn O/R mapping and reap the benefits from it,
    > but it's been a slow process. The Cayenne documentation is great in some
    > parts and in other areas it seems a bit sparse. I was wondering if
    > anyone else had links to cayenne documentation?
    >
    > Thank you very much and I hope to be a active member of this mailing
    > list soon,
    >
    > Jin Lee



    This archive was generated by hypermail 2.0.0 : Thu Dec 02 2004 - 14:37:39 EST