cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Object Creation and Settings Ids
Date Mon, 10 Apr 2006 11:50:21 GMT
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

Mime
View raw message