Primary key generation issue

From: Mehdi Bennani (mbennan..reebalance.com)
Date: Thu May 13 2004 - 15:37:26 EDT

  • Next message: Andrus Adamchik: "Re: R: event handling"

    Hey Guys,

    I have a question: ( I am running 1.1)
    Is there a way (without having to modify the cayenne code myself) to tell the 'reengineer database schema' tool to also generate the keys for the objEntities. I understand from the user guide documentation that you can ake that, i.e: add that PK manually, link it to the dbentity field and then re-generate the classes, but I was wondering whether there was a way for me to avoid doing that for every entity..as it gets painful.....
    Is there a reason why you guys do no want to expose that possibility as a flag? I am thinking of a simple AlsoGenerateKeyField textbox kindda thing.
    The reason is not only to be able to create new objEntities by setting the Id (in case where the ids are meaningful. I.e: SSN, userLoginId and so on...), but also for querying, and that is what bothers me the most...I would like to be able to say:
                    String expKey = "101";
                    Expression qual3 = ExpressionFactory.matchExp("depId",expKey);
                    SelectQuery query3 = new SelectQuery(Department.class,qual3);
                    List deps3 = ctxt.performQuery(query3);
                    ...
    If the depId field is not present in the object model (i.e: the Department objEntity), there is now way for me to be able to perform such query. (unless maybe using parametrized query I believe...I am not even sure.....or so...but that defies the purpose of the object model abstraction).

    Thank you.
    Sincerely,

    Mehdi Bennani
    Software Engineer
    FreeBalance Inc.
    Visit the new FreeBalance website..www.FreeBalance.com

    T (613) 236-5150 ext.325
    F (613) 236-7785
    mbennan..reeBalance.com

    This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient(s) please contact the sender by reply email and destroy all copies of the original message and any attachments.



    This archive was generated by hypermail 2.0.0 : Thu May 13 2004 - 15:37:30 EDT