Re: Object Creation and Settings Ids

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Apr 10 2006 - 07:50:21 EDT

  • Next message: Gentry, Michael \(Contractor\): "RE: Seeking to automate generation the cayenne schema"

    Technically this can be done by mapping a foreign key column as an
    ObjAttribute. Still it would go against the spirit of Cayenne. I
    suggest to use a real ItemType object. DataObjectUtils.objectForPk
    (..) should be a pretty efficient way to get a hold of ItemType
    instance, as after the object is fetched for the first time, it will
    be served from shared cache on subsequent calls.

    Andrus

    On Apr 10, 2006, at 2:02 PM, Dave Merrin wrote:
    > Hi,
    >
    > Given a new object I'd like to be able to set on of the properties
    > (a 'to'
    > property) without having the other object(only the ID). e.g.
    >
    > Item is the object I'm creating. It has a property called ItemType
    > which is
    > another object. I have the ItemType ID but not the actual object.
    > I'd like
    > to have a method called Item.setItemTypeID(Long itemTypeId).
    >
    > Is this possible?
    >
    > Cheers,
    >
    > Dave



    This archive was generated by hypermail 2.0.0 : Mon Apr 10 2006 - 07:50:47 EDT