You're right. I'm not sure how I missed that. I think when I tried it a few 
weeks ago something else was causing the object to get resolved and I just 
assumed it was the getter. Anyway, I found a "workaround" by calling 
getObjectContext().performQuery(new RelationshipQuery(getObjectId(), "artist", 
false)). I'll probably change it back.

Thanks,

David

On Mar 7, 2013, at 2:43 AM, Andrus Adamchik wrote:

> getArtist().getObjectId() or Cayenne.longPKForObject(getArtist()) actually 
> will not result in a DB round-trip. Cayenne returns a HOLLOW object for 
> simple to-one relationships. So this is the Cayenne way. 
> 
> If this doesn't work, could you please elaborate why you need a raw FK. Maybe 
> there's another way.
> 
> Andrus
> 
> 
> On Mar 6, 2013, at 8:38 PM, David Feshbach <[email protected]> wrote:
>> Is there any way to get the ObjectId or raw foreign key of a related object 
>> without faulting? I'd like to implement getArtistObjectId() or getArtistPK() 
>> without calling getArtist().getObjectId() or 
>> Cayenne.longPKForObject(getArtist()).
>> 
>> Thanks,
>> 
>> David
> 

Reply via email to