Re: Primary Key question

From: Scott McClure (scot..martblob.com)
Date: Thu Jul 22 2004 - 14:33:10 EDT

  • Next message: Andrus Adamchik: "Re: EventSubjects"

    I would like Cayenne to be responsible for generating the ID. What would need to
    be done to accomodate that?

    Scott

    Quoting Eric Schneider <eri..entralparksoftware.com>:

    > > I have an ID field that I use outside of Cayenne - the field is used
    > > for
    > > indexing and such, and therefore needs to be a presistent attribute. I
    > > want to
    > > know if this is possible without modifying the generated class like
    > > described
    > > in the documentation. I currently have the id attribute set as the
    > > primary key
    > > in the modeler and also mapped to the object entity. Will this work?
    >
    > If Cayenne isn't responsible for generating the id, it will work fine.
    >
    > > Second - if I need to find an object by primary key and I have it
    > > mapped to the
    > > object entity, is it faster to do a query or to use the new utilities
    > > in
    > > DataObjectUtils?
    >
    > Probably DataObjectUtils is the way to go. Any code you don't have to
    > write yourself is always good.
    >
    > cheers,
    > eric
    >
    >
    > On Jul 22, 2004, at 11:32 AM, Scott McClure wrote:
    >
    > > There has been lots of conversation on primary keys lately - a couple
    > > questions.
    > >
    > > I have an ID field that I use outside of Cayenne - the field is used
    > > for
    > > indexing and such, and therefore needs to be a presistent attribute. I
    > > want to
    > > know if this is possible without modifying the generated class like
    > > described
    > > in the documentation. I currently have the id attribute set as the
    > > primary key
    > > in the modeler and also mapped to the object entity. Will this work?
    > >
    > > Second - if I need to find an object by primary key and I have it
    > > mapped to the
    > > object entity, is it faster to do a query or to use the new utilities
    > > in
    > > DataObjectUtils?
    > >
    > > Thanks!
    > >
    > > Scott
    > >
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Jul 22 2004 - 14:33:12 EDT