cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Merrin" <dmer...@ipasystems.co.uk>
Subject RE: Object Creation and Settings Ids
Date Mon, 10 Apr 2006 14:58:11 GMT
Hi Andrus,

thanks for that. I think I'd tried it before but ran into validation
problems (I had a setToItemType() method and the db field is required).
Since then I've looked through and overridden the validateForSave method
(can't remember why). I should be able to modify this method to allow for
direct and indirect access.

Cheers,

Dave

> -----Original Message-----
> From: Andrus Adamchik [mailto:andrus@objectstyle.org]
> Sent: 10 April 2006 12:50
> To: cayenne-user@incubator.apache.org
> Subject: Re: Object Creation and Settings Ids
>
>
> 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