Re: Newbie questions

From: Todd Blanchard (tblanchar..ac.com)
Date: Sun Apr 04 2004 - 00:42:10 EST

  • Next message: Mike Kienenberger: "Re: Newbie questions"

    As a guy who has done a lot of WebObjects and is getting his feet wet
    with Cayenne, let me suggest that enum types are always modeled as
    relationships to lookup tables.

    IOW, if you have a Car and you can only have cars in Red, Yellow, and
    Blue, then create a CarColor table with a generated primary key and a
    value column, insert rows for Red, Yellow, and Blue, put a foreign key
    in Car for it, and implement the toOne relationship. This makes it
    easy to do your enums as popup menus setting a relationship. It also
    makes it easy to add new enum values later on without rebuilding your
    app.

    There are no enums - only reference tables. I don't think there's an
    Eclipse plugin, just the standalone app (which I prefer as I abhor
    Eclipse). Use it to save resources where Eclipse will find them.

    On Apr 3, 2004, at 9:07 PM, Todd O'Bryan wrote:

    > Just found Cayenne today, and I must say I'm very impressed. As
    > someone who may find his way to WebObjects at some point, I guess I
    > should make myself comfortable. I've spent some quality annoyed time
    > with Hibernate and I must say the modeler makes me feel like I'm
    > getting a lot accomplished even if I really haven't done anything
    > useful yet.
    >
    > A couple of questions:
    >
    > 1. Is there an Eclipse plugin for Cayenne, yet? If not, how do you use
    > Cayenne with Eclipse. Can you just set the directory for code
    > generation/xml files to be saved into as the src folder in an Eclipse
    > project and then Refresh in Eclipse when you make changes, or is there
    > some subtlety involved?
    >
    > 2. Is there any convenient way to deal with ENUM types, or do I have
    > to keep track of them myself?
    >
    > 3. Is there a direct equivalent of the MySQL type TEXT? What should I
    > use instead?
    >
    > 3. Am I correct in my current understanding of relationships which is
    > as follows: a relationship connects one field of one table to a field
    > of another table. You have to specify an attribute of one table to
    > hold an attribute value (probably a PK value) of another table. Then
    > you additionally have to specify that said attribute represents a
    > relationship. Is that right? I kept assuming that if I specified a
    > relationship the tool should be smart enough to stick in any extra
    > fields needed to effect the relationship for me, but I'm sensing
    > that's not right...
    >
    > Anyway, thanks for what looks to be a terrific tool. I teach high
    > school math and programming, so I don't get to spend a lot of time
    > programming, and when I do I want to feel like I'm accomplishing
    > something, not just spinning my wheels. Cayenne gave me that feeling,
    > since I could tell it to modify my database and then open it right up
    > from the command line to see if the changes took. Also, the fact that
    > it correctly connected made me feel better about the possibility that
    > it might in my code as well...
    >
    > Thanks,
    > Todd
    >



    This archive was generated by hypermail 2.0.0 : Sun Apr 04 2004 - 00:42:20 EST