cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Feshbach <>
Subject Re: Get ObjectId of To-One Relationship Without Faulting
Date Thu, 07 Mar 2013 15:52:25 GMT
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.



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 <> 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

View raw message