Re: Modeler reengineered DataMap relationship naming problem

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sat Oct 29 2005 - 13:43:47 EDT

  • Next message: Dov Rosenberg: "Re: CMS Advice"

    I agree with you conceptually, but the problem is that current or any
    other naming convention we may adopt knows nothing about naming
    conventions used by DB designers, so it will not work for everybody.

    E.g. I tend to append "_ID" at the end of the FK column name. So in
    my DB your example would look like "sender_id" and "reciever_id", and
    corresponding relationships would look like "toSenderId" and
    "toReceiverId" - maybe better that just "toPerson1", but still
    confusing and requiring manual renaming.

    Maybe we should identify 2-3 cases of most commonly used naming
    conventions (yours being one of them) and provide a choice during
    reverse engineering?

    > At least, can the Modeler indicate which fields are being used in
    > the ObjRelationship Inspector?

    Yes, that's another area where the modeler could use some
    improvement. Post Cayenne 1.2 I am thinking to redesign how joins are
    mapped to simplify the mapping. It would address this issue as well.

    Andrus

    On Oct 29, 2005, at 2:08 AM, Jeff de Vries wrote:
    > Would it be possible to have the Modeler, when it reverse engineers
    > a database, to use the *field names* to generate relationship names
    > instead of using the *types* to generate the names?
    >
    > Here's an example. Assume you have some tables like these (pseudo-
    > SQL):
    >
    > CREATE TABLE person
    > (
    > id int4 PRIMARY KEY,
    > ... other stuff
    > )
    >
    > CREATE TABLE message
    > (
    > id int4 PRIMARY KEY,
    > sender int4 FOREIGN KEY REFERENCES person(id),
    > receiver int4 FOREIGN KEY REFERENCES person(id),
    > original_message int4 FOREIGN KEY REFERENCES message(id),
    > ... other stuff
    > )
    >
    > After the Modeler reverse engineers the database, you get
    > relationships named like this:
    > [ObjEntity Message]
    > toPerson [ message -> person ]
    > toPerson1 [ message -> person ]
    > toMessage [ message -> message ]
    > messageArray [ message -> message, to many ]
    >
    > It's impossible from within the Modeler to tell whether toPerson or
    > toPerson1 is, for example, the person referenced by the "sender"
    > field. You have to go look at the XML file to figure it out. The
    > ObjRelationship Inspector doesn't help, because it just shows
    > [ message -> person ] without indicating which field it is using.
    > You're stuck manually changing all the relationship names, either
    > directly in the XML file, or, by looking at the XML file to decode
    > what you're seeing in the Modeler.
    >
    > Wouldn't it be better to use the field names? Something like this:
    > [ObjEntity Message]
    > toSender [ message(sender) -> person(id) ]
    > toReceiver [ message(receiver) -> person(id) ]
    > toOriginalMessage [ message(original_message) -> message(id) ]
    > originalMessageArray [this name still isn't quite right, but
    > there wouldn't be any way for the Modeler to figure out it's
    > actually the array of messages which refer back to this message and
    > come up with a meaningful name for that].
    >
    > At least, can the Modeler indicate which fields are being used in
    > the ObjRelationship Inspector?
    >
    > Thanks,
    > Jeff de Vries



    This archive was generated by hypermail 2.0.0 : Sat Oct 29 2005 - 13:43:50 EDT